netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Darren Jenkins <darrenrjenkins@gmail.com>
To: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>,
	linux-wimax@intel.com,
	Kernel Janitors <kernel-janitors@vger.kernel.org>
Cc: Cindy H Kao <cindy.h.kao@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	wimax@linuxwimax.org, netdev@vger.kernel.org
Subject: [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free
Date: Tue, 16 Mar 2010 22:46:28 +1100	[thread overview]
Message-ID: <1268739988.17270.8.camel@ICE-BOX> (raw)

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>
---
 drivers/net/wimax/i2400m/fw.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 25c24f0..a97c413 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -1490,7 +1490,8 @@ int i2400m_fw_bootstrap(struct i2400m *i2400m, const struct firmware *fw,
 	if (ret < 0)
 		dev_err(dev, "%s: cannot use: %d, skipping\n",
 			i2400m->fw_name, ret);
-	kfree(i2400m->fw_hdrs);
+	if (ret != -ENOMEM)
+		kfree(i2400m->fw_hdrs);
 	i2400m->fw_hdrs = NULL;
 	d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret);
 	return ret;
-- 
1.6.3.3

             reply	other threads:[~2010-03-16 11:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 11:46 Darren Jenkins [this message]
2010-03-16 21:14 ` [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free David Miller
2010-03-17  6:05   ` Inaky Perez-Gonzalez
  -- 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=1268739988.17270.8.camel@ICE-BOX \
    --to=darrenrjenkins@gmail.com \
    --cc=cindy.h.kao@intel.com \
    --cc=inaky.perez-gonzalez@intel.com \
    --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).