X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=net%2F802%2Fpsnap.c;h=31128cb92a23fc9b3eba377b52705671a3c984c7;hb=106449e870b3069c049a3486ae7b47995351270c;hp=7cba1f426081b61f45886c28f53a2cea5b93f602;hpb=9c70220b73908f64792422a2c39c593c4792f2c5;p=safe%2Fjmp%2Flinux-2.6 diff --git a/net/802/psnap.c b/net/802/psnap.c index 7cba1f4..31128cb 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_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; } /*