X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2F802%2Fpsnap.c;h=31128cb92a23fc9b3eba377b52705671a3c984c7;hb=973ed7c49a5c2271a10ce54ac06bba5617fca3a8;hp=270b9d2cae6589b983f9925ee728370aec74cec7;hpb=b4d8d1a93c6ea042b29bb66fbb1cf6bc556c18f7;p=linux-2.6-omap-h63xx.git diff --git a/net/802/psnap.c b/net/802/psnap.c index 270b9d2cae6..31128cb92a2 100644 --- a/net/802/psnap.c +++ b/net/802/psnap.c @@ -55,21 +55,28 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev, .type = __constant_htons(ETH_P_SNAP), }; + if (unlikely(!pskb_may_pull(skb, 5))) + goto drop; + rcu_read_lock(); - proto = find_snap_client(skb->h.raw); + proto = find_snap_client(skb_transport_header(skb)); if (proto) { /* Pass the frame on. */ - skb->h.raw += 5; + skb->transport_header += 5; skb_pull_rcsum(skb, 5); rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev); - } else { - skb->sk = NULL; - kfree_skb(skb); - rc = 1; } - rcu_read_unlock(); + + if (unlikely(!proto)) + goto drop; + +out: return rc; + +drop: + kfree_skb(skb); + goto out; } /* @@ -117,7 +124,7 @@ module_exit(snap_exit); */ struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, - struct net_device *, + struct net_device *, struct packet_type *, struct net_device *)) {