[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100422095327.GP29647@bicker>
Date: Thu, 22 Apr 2010 11:53:27 +0200
From: Dan Carpenter <error27@...il.com>
To: netdev@...r.kernel.org
Cc: Eric Dumazet <eric.dumazet@...il.com>,
Patrick McHardy <kaber@...sh.net>,
"Eric W. Biederman" <ebiederm@...stanetworks.com>,
Mitch Williams <mitch.a.williams@...el.com>,
"David S. Miller" <davem@...emloft.net>,
kernel-janitors@...r.kernel.org
Subject: [patch] rtnetlink: potential ERR_PTR dereference
In the original code, if rtnl_create_link() returned an ERR_PTR then that
would get passed to rtnl_configure_link() which dereferences it.
Signed-off-by: Dan Carpenter <error27@...il.com>
---
Found by a static checker, and compile tested only. :/
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4568120..fe776c9 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1270,10 +1270,11 @@ replay:
err = ops->newlink(net, dev, tb, data);
else
err = register_netdevice(dev);
- if (err < 0 && !IS_ERR(dev)) {
+
+ if (err < 0 && !IS_ERR(dev))
free_netdev(dev);
+ if (err < 0)
goto out;
- }
err = rtnl_configure_link(dev, ifm);
if (err < 0)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists