Skip to content

Commit 2c9d8e0

Browse files
TaeheeYoodavem330
authored andcommitted
netdevsim: fix unbalaced locking in nsim_create()
In the nsim_create(), rtnl_lock() is called before nsim_bpf_init(). If nsim_bpf_init() is failed, rtnl_unlock() should be called, but it isn't called. So, unbalanced locking would occur. Fixes: e05b2d1 ("netdevsim: move netdev creation/destruction to dev probe") Signed-off-by: Taehee Yoo <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3506b2f commit 2c9d8e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/netdevsim/netdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
302302
rtnl_lock();
303303
err = nsim_bpf_init(ns);
304304
if (err)
305-
goto err_free_netdev;
305+
goto err_rtnl_unlock;
306306

307307
nsim_ipsec_init(ns);
308308

@@ -316,8 +316,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
316316
err_ipsec_teardown:
317317
nsim_ipsec_teardown(ns);
318318
nsim_bpf_uninit(ns);
319+
err_rtnl_unlock:
319320
rtnl_unlock();
320-
err_free_netdev:
321321
free_netdev(dev);
322322
return ERR_PTR(err);
323323
}

0 commit comments

Comments
 (0)