Skip to content

Commit

Permalink
rtnetlink: potential ERR_PTR dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Apr 22, 2010
1 parent f4f914b commit 80032cf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,11 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
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)
Expand Down

0 comments on commit 80032cf

Please sign in to comment.