summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/slcan.c
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2020-03-21 14:08:29 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-22 03:57:15 +0100
commit2091a3d42b4f339eaeed11228e0cbe9d4f92f558 (patch)
tree34bd24f2f9fe2f7b558d4b21cf878bc6a907da87 /drivers/net/can/slcan.c
parentionic: make spdxcheck.py happy (diff)
downloadlinux-2091a3d42b4f339eaeed11228e0cbe9d4f92f558.tar.xz
linux-2091a3d42b4f339eaeed11228e0cbe9d4f92f558.zip
slcan: not call free_netdev before rtnl_unlock in slcan_open
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 f596c87005f7 ("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>
Diffstat (limited to 'drivers/net/can/slcan.c')
-rw-r--r--drivers/net/can/slcan.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 2f5c287eac95..a3664281a33f 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -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();