# Re: \[BUG\] Deadlock in \_cfg80211\_unregister\_wdev()

- From: Maximilian Luz \<luzmaximilian@gmail.com\>
- Date: 2021-05-14 13:46:18 
- List: linux-wireless
- Page: https://ratatoskr.run/linux-wireless/2021/05/11203196
- Thread: https://ratatoskr.run/linux-wireless/2021/05/11203160/t.md

```text
On 5/14/21 1:07 AM, Maximilian Luz wrote:
> Following commit a05829a7222e ("cfg80211: avoid holding the RTNL when
> calling the driver"), the mwifiex_pcie module fails to unload. This also
> prevents the device from rebooting / shutting down.
>
> Attempting to unload the module produces the log pasted below. Upon
> further investigation, this looks like a deadlock inside
> _cfg80211_unregister_wdev():
>
> - According to [1], this function expects the rdev->wiphy.mtx to be
>    held.
> - Down the line, this function (through some indirections, see third
>    trace in log below) calls call_netdevice_notifiers(NETDEV_GOING_DOWN,
>    ...) [2].
> - One of the registered notifiers seems to be
>    cfg80211_netdev_notifier_call(), which attempts to lock
>    rdev->wiphy.mtx again [3], completing the deadlock.

Looks like the underlying issue also leads to

  https://lore.kernel.org/linux-wireless/ab4d00ce52f32bd8e45ad0448a44737e@bewaar.me/

Regards,
Max
```
