summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChristian Engelmayer <cengelma@gmx.at>2014-01-11 22:19:30 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-15 00:40:56 +0100
commit267d29a69c6af39445f36102a832b25ed483f299 (patch)
tree2c26d9a5c2d40f6588b699c46917bba35e0b586d /net
parentnet: usbnet: fix SG initialisation (diff)
downloadlinux-267d29a69c6af39445f36102a832b25ed483f299.tar.xz
linux-267d29a69c6af39445f36102a832b25ed483f299.zip
ieee802154: Fix memory leak in ieee802154_add_iface()
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/nl-phy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index d08c7a43dcd1..89b265aea151 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);