Patchwork pppoe: Add missing sock_put() in pppoe_rcv()

login
register
mail settings
Submitter Jarek Poplawski
Date Oct. 30, 2008, 8:57 a.m.
Message ID <20081030085725.GA15289@ff.dom.local>
Download mbox | patch
Permalink /patch/6457/
State Superseded
Delegated to: David Miller
Headers show

Comments

Jarek Poplawski - Oct. 30, 2008, 8:57 a.m.
pppoe: Add missing sock_put() in pppoe_rcv()

Add missing sock_put() in pppoe_rcv() (introduced by
commit 392fdb0e35055b96faa9c1cd6ab537805337cdce).

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
[needed for stables 2.6.26 and later]

 drivers/net/pppoe.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu - Oct. 31, 2008, 4:26 a.m.
On Thu, Oct 30, 2008 at 08:57:25AM +0000, Jarek Poplawski wrote:
> pppoe: Add missing sock_put() in pppoe_rcv()
> 
> Add missing sock_put() in pppoe_rcv() (introduced by
> commit 392fdb0e35055b96faa9c1cd6ab537805337cdce).
> 
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

Good cath!

Thanks,
Herbert Xu - Oct. 31, 2008, 4:29 a.m.
On Thu, Oct 30, 2008 at 08:57:25AM +0000, Jarek Poplawski wrote:
>
> diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
> index fc6f4b8..c074276 100644
> --- a/drivers/net/pppoe.c
> +++ b/drivers/net/pppoe.c
> @@ -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,

Patch

diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index fc6f4b8..c074276 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -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);