diff options
author | Joonwoo Park <joonwpark81@gmail.com> | 2008-04-01 00:02:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-01 00:02:47 -0400 |
commit | f83f1768f833cb45bc93429fdc552252a4f55ac3 (patch) | |
tree | 15de7d2df2fc3a35e0a6b933bb37aefcba2cc3ef /net/llc/llc_station.c | |
parent | b50660f1fe4ebd6129064e4fba0bd882b60c2425 (diff) |
[LLC]: skb allocation size for responses
Allocate the skb for llc responses with the received packet size by
using the size adjustable llc_frame_alloc.
Don't allocate useless extra payload.
Cleanup magic numbers.
So, this fixes oops.
Reported by Jim Westfall:
kernel: skb_over_panic: text:c0541fc7 len:1000 put:997 head:c166ac00 data:c166ac2f tail:0xc166b017 end:0xc166ac80 dev:eth0
kernel: ------------[ cut here ]------------
kernel: kernel BUG at net/core/skbuff.c:95!
Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/llc/llc_station.c')
-rw-r--r-- | net/llc/llc_station.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c index 959e7f31833b..83da13339490 100644 --- a/net/llc/llc_station.c +++ b/net/llc/llc_station.c | |||
@@ -253,7 +253,8 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb) | |||
253 | static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) | 253 | static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) |
254 | { | 254 | { |
255 | int rc = 1; | 255 | int rc = 1; |
256 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); | 256 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, |
257 | sizeof(struct llc_xid_info)); | ||
257 | 258 | ||
258 | if (!nskb) | 259 | if (!nskb) |
259 | goto out; | 260 | goto out; |
@@ -274,7 +275,8 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb) | |||
274 | { | 275 | { |
275 | u8 mac_da[ETH_ALEN], dsap; | 276 | u8 mac_da[ETH_ALEN], dsap; |
276 | int rc = 1; | 277 | int rc = 1; |
277 | struct sk_buff* nskb = llc_alloc_frame(NULL, skb->dev); | 278 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, |
279 | sizeof(struct llc_xid_info)); | ||
278 | 280 | ||
279 | if (!nskb) | 281 | if (!nskb) |
280 | goto out; | 282 | goto out; |
@@ -298,7 +300,12 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb) | |||
298 | { | 300 | { |
299 | u8 mac_da[ETH_ALEN], dsap; | 301 | u8 mac_da[ETH_ALEN], dsap; |
300 | int rc = 1; | 302 | int rc = 1; |
301 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); | 303 | u32 data_size; |
304 | struct sk_buff *nskb; | ||
305 | |||
306 | /* The test request command is type U (llc_len = 3) */ | ||
307 | data_size = ntohs(eth_hdr(skb)->h_proto) - 3; | ||
308 | nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, data_size); | ||
302 | 309 | ||
303 | if (!nskb) | 310 | if (!nskb) |
304 | goto out; | 311 | goto out; |