]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "macsec: missing dev_put() on error in macsec_newlink()"
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 16 Apr 2018 10:17:50 +0000 (13:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Apr 2018 14:01:12 +0000 (10:01 -0400)
This patch is just wrong, sorry.  I was trying to fix a static checker
warning and misread the code.  The reference taken in macsec_newlink()
is released in macsec_free_netdev() when the netdevice is destroyed.

This reverts commit 8d38f14b34766f8d3872c2766e1f135f61cb0357.

Reported-by: Laura Abbott <labbott@redhat.com>
Fixes: 8d38f14b3476 ("macsec: missing dev_put() on error in macsec_newlink()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macsec.c

index 9cbb0c8a896aff9d192850ad15734dc2872c0dfb..7de88b33d5b96d7f18a5f7c242a54c935b587086 100644 (file)
@@ -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 put_dev;
+               goto unregister;
 
        /* need to be already registered so that ->init has run and
         * the MAC addr is set
@@ -3316,8 +3316,7 @@ del_dev:
        macsec_del_dev(macsec);
 unlink:
        netdev_upper_dev_unlink(real_dev, dev);
-put_dev:
-       dev_put(real_dev);
+unregister:
        unregister_netdevice(dev);
        return err;
 }