diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-21 19:53:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-22 18:57:26 -0400 |
commit | 80032cffb95edff4fc216b1cb21682257be326b7 (patch) | |
tree | e058d007a9db28dcb61a5903b6d79e5e6b96f0c3 /net | |
parent | f4f914b58019f0e50d521bbbadfaee260d766f95 (diff) |
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@gmail.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/rtnetlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4568120d8533..fe776c9ddeca 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1270,10 +1270,11 @@ replay: | |||
1270 | err = ops->newlink(net, dev, tb, data); | 1270 | err = ops->newlink(net, dev, tb, data); |
1271 | else | 1271 | else |
1272 | err = register_netdevice(dev); | 1272 | err = register_netdevice(dev); |
1273 | if (err < 0 && !IS_ERR(dev)) { | 1273 | |
1274 | if (err < 0 && !IS_ERR(dev)) | ||
1274 | free_netdev(dev); | 1275 | free_netdev(dev); |
1276 | if (err < 0) | ||
1275 | goto out; | 1277 | goto out; |
1276 | } | ||
1277 | 1278 | ||
1278 | err = rtnl_configure_link(dev, ifm); | 1279 | err = rtnl_configure_link(dev, ifm); |
1279 | if (err < 0) | 1280 | if (err < 0) |