Skip to content

Commit

Permalink
macsec: missing dev_put() on error in macsec_newlink()
Browse files Browse the repository at this point in the history
We moved the dev_hold(real_dev); call earlier in the function but forgot
to update the error paths.

Fixes: 0759e55 ("macsec: fix negative refcnt on parent link")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Mar 22, 2018
1 parent e0645d9 commit 5dcd840
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,7 +3277,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev,

err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0)
goto unregister;
goto put_dev;

/* need to be already registered so that ->init has run and
* the MAC addr is set
Expand Down Expand Up @@ -3316,7 +3316,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
macsec_del_dev(macsec);
unlink:
netdev_upper_dev_unlink(real_dev, dev);
unregister:
put_dev:
dev_put(real_dev);
unregister_netdevice(dev);
return err;
}
Expand Down

0 comments on commit 5dcd840

Please sign in to comment.