netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: herbert@gondor.hengli.com.au
Cc: tgohad@mvista.com, netdev@vger.kernel.org, tusharsg@gmail.com
Subject: Re: [PATCH] XFRM: Fix memory leak in xfrm_state_update
Date: Fri, 08 Jul 2011 08:59:11 -0700 (PDT)	[thread overview]
Message-ID: <20110708.085911.284201104178395050.davem@davemloft.net> (raw)
In-Reply-To: <20110708030032.GA25702@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.hengli.com.au>
Date: Fri, 8 Jul 2011 11:00:32 +0800

> On Thu, Jul 07, 2011 at 06:38:52PM -0700, Tushar Gohad wrote:
>>
>> Upon "ip xfrm state update ..", xfrm_add_sa() takes an extra reference on 
>> the user-supplied SA and forgets to drop the reference when  
>> xfrm_state_update() returns 0.  This leads to a memory leak as the  
>> parameter SA is never freed.  This change attempts to fix the leak by  
>> calling __xfrm_state_put() when xfrm_state_update() updates a valid SA  
>> (err = 0).  The parameter SA is added to the gc list when the final  
>> reference is dropped by xfrm_add_sa() upon completion.
>>
>> Signed-off-by: Tushar Gohad <tgohad@mvista.com>
> 
> Ouch, thanks for catching this bug!
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks.

      reply	other threads:[~2011-07-08 15:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08  1:38 [PATCH] XFRM: Fix memory leak in xfrm_state_update Tushar Gohad
2011-07-08  3:00 ` Herbert Xu
2011-07-08 15:59   ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110708.085911.284201104178395050.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=herbert@gondor.hengli.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=tgohad@mvista.com \
    --cc=tusharsg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).