netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ieee802154: Fix memory leak in ieee802154_add_iface()
@ 2014-01-11 21:19 Christian Engelmayer
  2014-01-14 23:41 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Engelmayer @ 2014-01-11 21:19 UTC (permalink / raw)
  To: Alexander Smirnov, Dmitry Eremin-Solenikov; +Cc: netdev, linux-zigbee-devel

Fix a memory leak in the ieee802154_add_iface() error handling path.
Detected by Coverity: CID 710490.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
This patch fixes an issue introduced in 

   commit 90c049b2c6ae26d1a4d526d660a976620eaa554a
   Author: alex.bluesman.smirnov@gmail.com <alex.bluesman.smirnov@gmail.com>
   Date:   Tue May 15 20:50:27 2012 +0000

ieee802154: interface type to be added
---
 net/ieee802154/nl-phy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index d08c7a4..89b265a 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -221,8 +221,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
 
 	if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) {
 		type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]);
-		if (type >= __IEEE802154_DEV_MAX)
-			return -EINVAL;
+		if (type >= __IEEE802154_DEV_MAX) {
+			rc = -EINVAL;
+			goto nla_put_failure;
+		}
 	}
 
 	dev = phy->add_iface(phy, devname, type);
-- 
1.8.3.2

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

* Re: [PATCH] ieee802154: Fix memory leak in ieee802154_add_iface()
  2014-01-11 21:19 [PATCH] ieee802154: Fix memory leak in ieee802154_add_iface() Christian Engelmayer
@ 2014-01-14 23:41 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-01-14 23:41 UTC (permalink / raw)
  To: cengelma; +Cc: alex.bluesman.smirnov, dbaryshkov, netdev, linux-zigbee-devel

From: Christian Engelmayer <cengelma@gmx.at>
Date: Sat, 11 Jan 2014 22:19:30 +0100

> Fix a memory leak in the ieee802154_add_iface() error handling path.
> Detected by Coverity: CID 710490.
> 
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2014-01-14 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 21:19 [PATCH] ieee802154: Fix memory leak in ieee802154_add_iface() Christian Engelmayer
2014-01-14 23:41 ` 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).