Forwarded: [PATCH] INFO: task hung in ieee80211_register_hw (8)

syzbot posted 1 patch 1 week, 3 days ago
There is a newer version of this series
Forwarded: [PATCH] INFO: task hung in ieee80211_register_hw (8)
Posted by syzbot 1 week, 3 days ago
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] INFO: task hung in ieee80211_register_hw (8)
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master

Reported-by: syzbot+c92af8613ad38696ff09@syzkaller.appspotmail.com

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 02b6d81cc..de3bfeaa3 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -7156,6 +7156,15 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
 	.resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX
 	.mcgrps = hwsim_mcgrps,
 	.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
+	/*
+	 * HWSIM_CMD_NEW_RADIO goes through ieee80211_register_hw(), which
+	 * acquires the RTNL mutex.  Without parallel_ops the generic netlink
+	 * core serializes all of these handlers with genl_mutex, so a task
+	 * would hold genl_mutex while waiting for RTNL and can deadlock with
+	 * code that holds RTNL and needs genl_mutex.  The radio list is
+	 * protected by hwsim_radio_lock, so the handlers can run in parallel.
+	 */
+	.parallel_ops = true,
 };
 
 static void remove_user_radios(u32 portid, int netgroup)