From: Inaky Perez-Gonzalez <inaky@linux.intel.com>
To: David Miller <davem@davemloft.net>
Cc: cindy.h.kao@intel.com, wimax@linuxwimax.org,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-wimax@intel.com,
darrenrjenkins@gmail.com
Subject: Re: [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free
Date: Tue, 16 Mar 2010 23:05:47 -0700 [thread overview]
Message-ID: <1268805947.2310.1.camel@localhost.localdomain> (raw)
In-Reply-To: <20100316.141445.27416807.davem@davemloft.net>
On Tue, 2010-03-16 at 14:14 -0700, David Miller wrote:
> From: Darren Jenkins <darrenrjenkins@gmail.com>
> Date: Tue, 16 Mar 2010 22:46:28 +1100
>
> > i2400m_fw_check() can free i2400m->fw_hdrs if krealloc() fails causing a double free
> > Add a check so we don't free the memory a second time.
> >
> > coverity CID: 13455
> >
> > Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
>
> Please don't fix it like this, the check is obscure and it's
> allowing other bugs to happen.
>
> If krealloc() fails, any refrence to i2400m->fw_hdrs is
> referencing freed memory.
>
> Therefore the krealloc() failure handling in this driver should NULL
> out i2400m->fw_hdrs and that will fix the double kfree problem as well
> as trap any stray references.
I agree with David, the fix is quite obscure. The error path in
i2400m_fw_check()'s call to i2400m_kzrealloc_2x() should be rather
cleaning up in a better way.
next prev parent reply other threads:[~2010-03-17 6:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 11:46 [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free Darren Jenkins
2010-03-16 21:14 ` David Miller
2010-03-17 6:05 ` Inaky Perez-Gonzalez [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-03-17 12:40 Darren Jenkins
2010-03-17 22:10 ` Inaky Perez-Gonzalez
2010-03-18 8:46 Darren Jenkins
2010-03-20 21:24 ` David Miller
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=1268805947.2310.1.camel@localhost.localdomain \
--to=inaky@linux.intel.com \
--cc=cindy.h.kao@intel.com \
--cc=darrenrjenkins@gmail.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wimax@intel.com \
--cc=netdev@vger.kernel.org \
--cc=wimax@linuxwimax.org \
/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).