В ядре Linux устранена следующая уязвимость:
wifi: cfg80211: преобразовать pmsr_free_wk в wiphy_work, чтобы устранить взаимоблокировку
Когда сокет netlink, которому принадлежит сеанс PMSR, закрывается,
cfg80211_release_pmsr() очищает nl_portid запроса и очереди
pmsr_free_wk для асинхронного вызова cfg80211_pmsr_process_abort(). Если интерфейс одновременно отключается, cfg80211_pmsr_wdev_down()
вызывается под wiphy_lock и вызывает cancel_work_sync(&pmsr_free_wk)
ждать какой-либо текущей работы. Рабочая функция получает wiphy_lock
через Guard(wiphy) перед вызовом Process_abort.
Это тупик: wdev_down удерживает wiphy_lock и блокируется внутри
cancel_work_sync(); pmsr_free_wk блокирует попытку получить то же самое
Wiphy_lock. Ни один из потоков не может продолжить работу. Тот же тупик доступен из cfg80211_leave_locked(), который
вызывает cfg80211_pmsr_wdev_down() для всех типов интерфейсов в
Wiphy_lock.
Исправьте это, преобразовав pmsr_free_wk из простой рабочей_структуры в
Wiphy_work. Диспетчер wiphy_work удерживает wiphy_lock при запуске.
рабочие элементы, поэтому явная защита (wiphy) в рабочей функции отсутствует.
дольше нужно. Wiphy_work_cancel() можно безопасно вызывать, удерживая
wiphy_lock — поскольку Wiphy_lock предотвращает запуск работы
одновременно с этим функция wiphy_work_cancel() никогда не блокируется, устраняя
тупик. Удалите cancel_work_sync() для pmsr_free_wk из
Обработчик NETDEV_GOING_DOWN. cfg80211_leave(), вызывается безоговорочно
непосредственно перед этим уже отменяет любую ожидающую работу под wiphy_lock
через wiphy_work_cancel() внутри cfg80211_pmsr_wdev_down().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: wifi: cfg80211: convert pmsr_free_wk to wiphy_work to fix deadlock When a netlink socket that owns a PMSR session is closed, cfg80211_release_pmsr() clears the request's nl_portid and queues pmsr_free_wk to call cfg80211_pmsr_process_abort() asynchronously. If the interface tears down concurrently, cfg80211_pmsr_wdev_down() is called under wiphy_lock and calls cancel_work_sync(&pmsr_free_wk) to wait for any running work. The work function acquires wiphy_lock via guard(wiphy) before calling process_abort. This is a deadlock: wdev_down holds wiphy_lock and blocks inside cancel_work_sync(); pmsr_free_wk blocks trying to acquire that same wiphy_lock. Neither thread can proceed. The same deadlock is reachable from cfg80211_leave_locked(), which calls cfg80211_pmsr_wdev_down() for all interface types under wiphy_lock. Fix this by converting pmsr_free_wk from a plain work_struct to a wiphy_work. The wiphy_work dispatcher holds wiphy_lock when running work items, so the explicit guard(wiphy) in the work function is no longer needed. wiphy_work_cancel() can be called safely while holding wiphy_lock - since wiphy_lock prevents the work from running concurrently, wiphy_work_cancel() never blocks, eliminating the deadlock. Remove the cancel_work_sync() for pmsr_free_wk from the NETDEV_GOING_DOWN handler. cfg80211_leave(), called unconditionally just before it, already cancels any pending work under wiphy_lock via wiphy_work_cancel() inside cfg80211_pmsr_wdev_down().