lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20081030.231159.155700598.davem@davemloft.net>
Date:	Thu, 30 Oct 2008 23:11:59 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	herbert@...dor.apana.org.au
Cc:	jarkao2@...il.com, jeff@...zik.org, netdev@...r.kernel.org
Subject: Re: [PATCH] pppoe: Add missing sock_put() in pppoe_rcv()

From: Herbert Xu <herbert@...dor.apana.org.au>
Date: Fri, 31 Oct 2008 12:29:20 +0800

> 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.

That sounds like a good idea, I'll commit the following:

commit fb764c5b742fdab5615f4a1bac9f43df73599ce3
Author: David S. Miller <davem@...emloft.net>
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.
    
    Signed-off-by: David S. Miller <davem@...emloft.net>

diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index fc6f4b8..b646e92 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);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ