Commit 5dcd8400 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

macsec: missing dev_put() on error in macsec_newlink()

We moved the dev_hold(real_dev); call earlier in the function but forgot
to update the error paths.

Fixes: 0759e552 ("macsec: fix negative refcnt on parent link")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e0645d9b
...@@ -3277,7 +3277,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev, ...@@ -3277,7 +3277,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
err = netdev_upper_dev_link(real_dev, dev, extack); err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0) if (err < 0)
goto unregister; goto put_dev;
/* need to be already registered so that ->init has run and /* need to be already registered so that ->init has run and
* the MAC addr is set * the MAC addr is set
...@@ -3316,7 +3316,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev, ...@@ -3316,7 +3316,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
macsec_del_dev(macsec); macsec_del_dev(macsec);
unlink: unlink:
netdev_upper_dev_unlink(real_dev, dev); netdev_upper_dev_unlink(real_dev, dev);
unregister: put_dev:
dev_put(real_dev);
unregister_netdevice(dev); unregister_netdevice(dev);
return err; return err;
} }
......
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