netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netdevsim: fix unbalaced locking in nsim_create()
@ 2020-07-18  6:49 Taehee Yoo
  2020-07-20 17:57 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Taehee Yoo @ 2020-07-18  6:49 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: jiri, ap420073

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: e05b2d141fef ("netdevsim: move netdev creation/destruction to dev probe")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
 drivers/net/netdevsim/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 2908e0a0d6e1..b2a67a88b6ee 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -316,8 +316,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
 err_ipsec_teardown:
 	nsim_ipsec_teardown(ns);
 	nsim_bpf_uninit(ns);
-	rtnl_unlock();
 err_free_netdev:
+	rtnl_unlock();
 	free_netdev(dev);
 	return ERR_PTR(err);
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-21  4:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-18  6:49 [PATCH net] netdevsim: fix unbalaced locking in nsim_create() Taehee Yoo
2020-07-20 17:57 ` Jakub Kicinski
2020-07-21  4:15   ` Taehee Yoo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).