wifi: mt76: mt7921: fix deadlock in mt7921_abort_roc
authorFelix Fietkau <nbd@nbd.name>
Wed, 21 Dec 2022 10:47:47 +0000 (11:47 +0100)
committerFelix Fietkau <nbd@nbd.name>
Fri, 3 Feb 2023 13:47:15 +0000 (14:47 +0100)
commitde19b9c83654e323d83f839a550ca4af37fea15b
tree2dca5a07067ef49f962631f5ff468d834ee986e0
parent8065c0e13f9875f597920a2af47e5dc2940a9c4f
wifi: mt76: mt7921: fix deadlock in mt7921_abort_roc

When mt7921_abort_roc is called with dev->mutex held, it can deadlock while
calling cancel_work_sync(&phy->roc_work), because the work function could
be waiting to acquire the mutex.

Fix this by flushing the work before taking the mutex

Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support")
Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/main.c