Skip to content

Commit

Permalink
pppoe: Fix socket leak.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Oct 31, 2008
1 parent 721d5df commit 263e69c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 263e69c

Please sign in to comment.