]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net_failover: fixed rollback in net_failover_open()
authorVasily Averin <vvs@virtuozzo.com>
Tue, 2 Jun 2020 12:55:26 +0000 (15:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jun 2020 22:35:53 +0000 (15:35 -0700)
found by smatch:
drivers/net/net_failover.c:65 net_failover_open() error:
 we previously assumed 'primary_dev' could be null (see line 43)

Fixes: 8a44e20be97a ("net: Introduce net_failover driver")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/net_failover.c

index b16a1221d19b97029c84a9e91d06a70babe4a9db..fb182bec8f062378414235ac81e11d4520f6f010 100644 (file)
@@ -61,7 +61,8 @@ static int net_failover_open(struct net_device *dev)
        return 0;
 
 err_standby_open:
-       dev_close(primary_dev);
+       if (primary_dev)
+               dev_close(primary_dev);
 err_primary_open:
        netif_tx_disable(dev);
        return err;