Skip to content

Commit

Permalink
6lowpan: Fix null pointer dereference in UDP uncompression function
Browse files Browse the repository at this point in the history
When a UDP packet gets fragmented, a crash will occur at reassembly time.
This is because skb->transport_header is not set during earlier period of fragment reassembly.
As a consequence, call to udp_hdr() return NULL and uh (which is NULL) gets
dereferenced without much test.

Signed-off-by: Tony Cheneau <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tcheneau authored and davem330 committed Jul 17, 2012
1 parent 6e5928f commit d4787a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ieee802154/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ lowpan_uncompress_udp_header(struct sk_buff *skb)
struct udphdr *uh = udp_hdr(skb);
u8 tmp;

if (!uh)
goto err;

if (lowpan_fetch_skb_u8(skb, &tmp))
goto err;

Expand Down

0 comments on commit d4787a1

Please sign in to comment.