netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Darren Jenkins <darrenrjenkins@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: inaky.perez-gonzalez@intel.com, linux-wimax@intel.com,
	kernel-janitors@vger.kernel.org, cindy.h.kao@intel.com,
	dirk.j.brandewie@intel.com, wimax@linuxwimax.org,
	netdev@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free
Date: Wed, 17 Mar 2010 23:40:38 +1100	[thread overview]
Message-ID: <1268829638.10618.28.camel@ICE-BOX> (raw)


On Wed, Mar 17, 2010 at 8:14 AM, David Miller <davem@davemloft.net>
wrote:

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

Yes that is a much better Idea. Thanks for the advice. 
It also fixes the i2400m_barker_db problem that I didn't notice before.


Fix double free on krealloc() failure by zeroing pointer

coverity CID: 13455

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
---
 drivers/net/wimax/i2400m/fw.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 25c24f0..9f3b594 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -232,8 +232,9 @@ int i2400m_zrealloc_2x(void **ptr, size_t *_count, size_t el_size,
 		*_count = new_count;
 		*ptr = nptr;
 		return 0;
-	} else
-		return -ENOMEM;
+	}
+	*ptr = NULL;
+	return -ENOMEM;
 }
 
 
-- 
1.6.3.3

 





             reply	other threads:[~2010-03-17 12:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 12:40 Darren Jenkins [this message]
2010-03-17 22:10 ` [PATCH] drivers/net/wimax/i2400m/fw.c fix possible double free Inaky Perez-Gonzalez
  -- strict thread matches above, loose matches on Subject: below --
2010-03-18  8:46 Darren Jenkins
2010-03-20 21:24 ` David Miller
2010-03-16 11:46 Darren Jenkins
2010-03-16 21:14 ` David Miller
2010-03-17  6:05   ` Inaky Perez-Gonzalez

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=1268829638.10618.28.camel@ICE-BOX \
    --to=darrenrjenkins@gmail.com \
    --cc=cindy.h.kao@intel.com \
    --cc=davem@davemloft.net \
    --cc=dirk.j.brandewie@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).