pppoe: Add missing sock_put() in pppoe_rcv()
Subsystems (2)
PATCH 1/1 pppoe: Add missing sock_put() in pppoe_rcv()
pppoe: Add missing sock_put() in pppoe_rcv()
Add missing sock_put() in pppoe_rcv() (introduced by commit 392fdb0e35055b96faa9c1cd6ab537805337cdce).
---
[needed for stables 2.6.26 and later]
drivers/net/pppoe.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/pppoe.c +3 -1
@@ -403,8 +403,10 @@ static int pppoe_rcv(struct sk_buff *skb,if (!po) goto drop; -if (pskb_trim_rcsum (skb, len)) +if (pskb_trim_rcsum (skb, len)) { +sock_put (sk_pppox (po)); goto drop; + }return sk_receive_skb (sk_pppox (po), skb,0 );
Quoted 6 lines · Jarek Poplawski
pppoe: Add missing
sock_put()inpppoe_rcv()Add missing
sock_put()inpppoe_rcv()(introduced by commit392fdb0e35055b96faa9c1cd6ab537805337cdce).Signed-off-by Jarek Poplawski <[email protected]>
Good cath!
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 6 lines · Jarek Poplawski
drivers/net/pppoe.c +0
-0
drivers/net/pppoe.c static int pppoe_rcv(struct sk_buff *skb, · line 409
Quoted 8 lines
drivers/net/pppoe.c +3
-1@@ -403,8 +403,10 @@ static int pppoe_rcv(struct sk_buff *skb,if (!po) goto drop; -if (pskb_trim_rcsum (skb, len)) +if (pskb_trim_rcsum (skb, len)) { +sock_put (sk_pppox (po)); goto drop; + }
Actually we might be better off moving the trim before the get_item call.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtDavid Miller
maintainerFrom: Herbert Xu <[email protected]>
Date: Fri, 31 Oct 2008 12:29:20 +0800
Quoted 10 lines · Jarek Poplawski
Quoted 9 lines
drivers/net/pppoe.c +0
-0@@ -403,8 +403,10 @@ static int pppoe_rcv(struct sk_buff *skb,if (!po) goto drop;
Quoted 8 lines
drivers/net/pppoe.c static int pppoe_rcv(struct sk_buff *skb, · line 409
Quoted 5 lines
drivers/net/pppoe.c +3
-1-if (pskb_trim_rcsum (skb, len)) +if (pskb_trim_rcsum (skb, len)) { +sock_put (sk_pppox (po)); goto drop; + }Actually we might be better off moving the trim before the
get_itemcall.
That sounds like a good idea, I'll commit the following:
commit fb764c5b742fdab5615f4a1bac9f43df73599ce3
Author: David S. Miller <[email protected]> Date: Thu Oct 30 23:11:44 2008 -0700
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.
drivers/net/pppoe.c +3 -3
@@ -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 );