From: David S. Miller Date: Fri, 31 Oct 2008 06:11:44 +0000 (-0700) Subject: pppoe: Fix socket leak. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=263e69cbc9e5a9e7bcf6a24f641ef0717d1ae4df;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git pppoe: Fix socket leak. 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 --- diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index fc6f4b8c64b..b646e92134d 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c @@ -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);