]> git.baikalelectronics.ru Git - kernel.git/commitdiff
slcan: not call free_netdev before rtnl_unlock in slcan_open
authorOliver Hartkopp <socketcan@hartkopp.net>
Sat, 21 Mar 2020 13:08:29 +0000 (14:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Mar 2020 02:57:15 +0000 (19:57 -0700)
As the description before netdev_run_todo, we cannot call free_netdev
before rtnl_unlock, fix it by reorder the code.

This patch is a 1:1 copy of upstream slip.c commit d3cec769ed03
("slip: not call free_netdev before rtnl_unlock in slip_open").

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

index 2f5c287eac95761f1a57110078875f6615b944f4..a3664281a33fca9d8875905956c22b678f2bc1b5 100644 (file)
@@ -625,7 +625,10 @@ err_free_chan:
        tty->disc_data = NULL;
        clear_bit(SLF_INUSE, &sl->flags);
        slc_free_netdev(sl->dev);
+       /* do not call free_netdev before rtnl_unlock */
+       rtnl_unlock();
        free_netdev(sl->dev);
+       return err;
 
 err_exit:
        rtnl_unlock();