mbox series

[0/2] Fix ieee80211_color_collision_detection_work() locking

Message ID 20240924192805.13859-1-repk@triplefau.lt
Headers show
Series Fix ieee80211_color_collision_detection_work() locking | expand

Message

Remi Pommarel Sept. 24, 2024, 7:28 p.m. UTC
Call to ieee80211_color_collision_detection_work() needs wiphy lock to be
held. This lock cannot be taken directly in the delayed work because it
would cause a potential deadlock. Indeed ieee80211_link_stop() is calling
cancel_delayed_work_sync() with the lock held. To avoid such deadlock one
can use a wiphy delayed work instead.

Thus this patchset convert ieee80211_color_collision_detection_work() to
use wiphy delayed work instead of classical delayed work. But because
this work is used to ratelimit cfg80211_obss_color_collision_notify() a
way to tell if it has already been scheduled is needed as discussed in
[0]. In this thread three different solutions has been considered:

  - Implementing wiphy_delayed_work_pending() to detect if work can be
    queued without postponing a previous schedule

  - Using a __ratelimit or an equivalent to queue the work

  - Modifying wiphy_delayed_work_queue() to mimic queue_delayed_work() by
    not queuing the work if already queued (while also possibly having to
    add wiphy_delayed_work_mod() for those who need the mod_delayed_work()
    behavior).

This patchset implement the first solution.

[0]: https://lore.kernel.org/linux-wireless/D4A40Q44OAY2.W3SIF6UEPBUN@freebox.fr/

Remi Pommarel (2):
  wifi: cfg80211: Add wiphy_delayed_work_pending()
  wifi: mac80211: Convert color collision detection to wiphy work

 include/net/cfg80211.h     | 44 ++++++++++++++++++++++++++++++++++++++
 net/mac80211/cfg.c         | 17 ++++++++-------
 net/mac80211/ieee80211_i.h |  5 +++--
 net/mac80211/link.c        |  7 +++---
 net/wireless/core.c        |  7 ++++++
 5 files changed, 67 insertions(+), 13 deletions(-)