slip: not call free_netdev before rtnl_unlock in slip_open
authoryangerkun <yangerkun@huawei.com>
Wed, 26 Feb 2020 03:54:35 +0000 (11:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Feb 2020 04:37:06 +0000 (20:37 -0800)
As the description before netdev_run_todo, we cannot call free_netdev
before rtnl_unlock, fix it by reorder the code.

Signed-off-by: yangerkun <yangerkun@huawei.com>
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/slip/slip.c

index 6f4d7ba8b1094eac73b0ea503bee81d9d976178c..babb01888b786c2e77c9d7b4844f44d31b9c7bce 100644 (file)
@@ -863,7 +863,10 @@ err_free_chan:
        tty->disc_data = NULL;
        clear_bit(SLF_INUSE, &sl->flags);
        sl_free_netdev(sl->dev);
+       /* do not call free_netdev before rtnl_unlock */
+       rtnl_unlock();
        free_netdev(sl->dev);
+       return err;
 
 err_exit:
        rtnl_unlock();