Commit 80032cff authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

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: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4f914b5
...@@ -1270,10 +1270,11 @@ replay: ...@@ -1270,10 +1270,11 @@ replay:
err = ops->newlink(net, dev, tb, data); err = ops->newlink(net, dev, tb, data);
else else
err = register_netdevice(dev); err = register_netdevice(dev);
if (err < 0 && !IS_ERR(dev)) {
if (err < 0 && !IS_ERR(dev))
free_netdev(dev); free_netdev(dev);
if (err < 0)
goto out; goto out;
}
err = rtnl_configure_link(dev, ifm); err = rtnl_configure_link(dev, ifm);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment