]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pppoe: Fix socket leak.
authorDavid S. Miller <davem@davemloft.net>
Fri, 31 Oct 2008 06:11:44 +0000 (23:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Oct 2008 06:35:02 +0000 (23:35 -0700)
Move SKB trim before we lookup the socket so we don't have to
put it on failure.

Based upon an initial patch by Jarek Poplawski and suggestions
from Herbert Xu.

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pppoe.c

index fc6f4b8c64b35cc169ab228c9c130b6ed0a4c821..b646e92134dc79a6bbfe6e55f7c80fd0ea19d3f1 100644 (file)
@@ -399,11 +399,11 @@ static int pppoe_rcv(struct sk_buff *skb,
        if (skb->len < len)
                goto drop;
 
-       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
-       if (!po)
+       if (pskb_trim_rcsum(skb, len))
                goto drop;
 
-       if (pskb_trim_rcsum(skb, len))
+       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
+       if (!po)
                goto drop;
 
        return sk_receive_skb(sk_pppox(po), skb, 0);