aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pppoe.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-31 02:11:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 02:35:02 -0400
commit263e69cbc9e5a9e7bcf6a24f641ef0717d1ae4df (patch)
treeb82cb19bc63531782b018b3ad70c5e58dab44569 /drivers/net/pppoe.c
parent721d5dfe7e516954c501d5e9d0dfab379cf4241a (diff)
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 <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r--drivers/net/pppoe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index fc6f4b8c64b3..b646e92134dc 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -399,11 +399,11 @@ static int pppoe_rcv(struct sk_buff *skb,
399 if (skb->len < len) 399 if (skb->len < len)
400 goto drop; 400 goto drop;
401 401
402 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 402 if (pskb_trim_rcsum(skb, len))
403 if (!po)
404 goto drop; 403 goto drop;
405 404
406 if (pskb_trim_rcsum(skb, len)) 405 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
406 if (!po)
407 goto drop; 407 goto drop;
408 408
409 return sk_receive_skb(sk_pppox(po), skb, 0); 409 return sk_receive_skb(sk_pppox(po), skb, 0);