netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ieee802154: Fix possible NULL pointer dereference in wpan_phy_alloc
@ 2010-05-23 15:45 Denis Kirjanov
  2010-05-24  6:12 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Kirjanov @ 2010-05-23 15:45 UTC (permalink / raw)
  To: davem; +Cc: dbaryshkov, netdev

Check for NULL pointer after kzalloc

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
net/ieee802154/wpan-class.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c
index 3d803a1..1627ef2 100644
--- a/net/ieee802154/wpan-class.c
+++ b/net/ieee802154/wpan-class.c
@@ -147,13 +147,15 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
 	struct wpan_phy *phy = kzalloc(sizeof(*phy) + priv_size,
 			GFP_KERNEL);
 
+	if (!phy)
+		goto out;
 	mutex_lock(&wpan_phy_mutex);
 	phy->idx = wpan_phy_idx++;
 	if (unlikely(!wpan_phy_idx_valid(phy->idx))) {
 		wpan_phy_idx--;
 		mutex_unlock(&wpan_phy_mutex);
 		kfree(phy);
-		return NULL;
+		goto out;
 	}
 	mutex_unlock(&wpan_phy_mutex);
 
@@ -168,6 +170,9 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
 	phy->current_page = 0; /* for compatibility */
 
 	return phy;
+
+out:
+	return NULL;
 }
 EXPORT_SYMBOL(wpan_phy_alloc);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ieee802154: Fix possible NULL pointer dereference in wpan_phy_alloc
  2010-05-23 15:45 [PATCH] ieee802154: Fix possible NULL pointer dereference in wpan_phy_alloc Denis Kirjanov
@ 2010-05-24  6:12 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-05-24  6:12 UTC (permalink / raw)
  To: dkirjanov; +Cc: dbaryshkov, netdev

From: Denis Kirjanov <dkirjanov@hera.kernel.org>
Date: Sun, 23 May 2010 15:45:45 +0000

> Check for NULL pointer after kzalloc
> 
> Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-24  6:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-23 15:45 [PATCH] ieee802154: Fix possible NULL pointer dereference in wpan_phy_alloc Denis Kirjanov
2010-05-24  6:12 ` David Miller

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