Re: [syzbot] Re: [wireless?] INFO: task hung in cfg80211_event_work (4)

From: syzbot
Date: Sun Oct 13 2024 - 22:53:28 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [wireless?] INFO: task hung in cfg80211_event_work (4)
Author: lizhi.xu@xxxxxxxxxxxxx

When hwsim and regulatory are used simultaneously, a race occurs for the
lock "wiphy.mtx", it cause hung in cfg80211_event_work.
The hwsim is a developer testing tool, so maybe using mutex_trylock
insead of mutex_lock is more reasonable.

#syz test

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 661adfc77644..4e8a6c76b12d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -331,7 +331,8 @@ static void cfg80211_event_work(struct work_struct *work)
rdev = container_of(work, struct cfg80211_registered_device,
event_work);

- wiphy_lock(&rdev->wiphy);
+ if (!mutex_trylock(&rdev->wiphy.mtx))
+ return;
cfg80211_process_rdev_events(rdev);
wiphy_unlock(&rdev->wiphy);
}