ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: Ajrat Makhmutov <rauty@altlinux.org>
To: devel-kernel@lists.altlinux.org
Subject: Re: [d-kernel] [PATCH 3/2] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync
Date: Thu, 11 Jun 2026 14:15:20 +0300
Message-ID: <2f111be2-002b-4641-9fc4-8dededf9baef@altlinux.org> (raw)
In-Reply-To: <7f0d3faa-8609-b404-0aa1-4f5f679556f3@basealt.ru>

Привет, Василий!

11.06.2026 14:07, Vasiliy Kovalev пишет:
> Добрый день,
>
> On 6/11/26 13:44, Ajrat Makhmutov wrote:
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>
> При бэкпортировании следует указывать хэш оригинального коммита из 
> mainline, например:
>
> commit d5059e52fd8bc624ec4255c9fa01a266513d126b upstream.
>
>> roc_abort_sync() can deadlock with roc_work(). roc_work() holds
>> dev->mt76.mutex, while cancel_work_sync() waits for roc_work()
>> to finish. If the caller already owns the same mutex, both
>> sides block and no progress is possible.
>>
>> This deadlock can occur during station removal when
>> mt76_sta_state() -> mt76_sta_remove() -> mt7921_mac_sta_remove() ->
>> mt7921_roc_abort_sync() invokes cancel_work_sync() while
>> roc_work() is still running and holding dev->mt76.mutex.
>>
>> This avoids the mutex deadlock and preserves exactly-once
>> work ownership.
>>
>> Fixes: 352d966126e6 ("wifi: mt76: mt7921: fix a potential association 
>> failure upon resuming")
>> Co-developed-by: Quan Zhou <quan.zhou@mediatek.com>
>> Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> Link: 
>> https://patch.msgid.link/20260126180013.8167-1-sean.wang@kernel.org
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> (cherry picked from commit d5059e52fd8bc624ec4255c9fa01a266513d126b)
>
> cherry picked здесь не дает полезной информации, можно убрать
>
>> [ALT: keep del_timer_sync() instead of timer_delete_sync() — the
>>   timer API rename is not present in 6.12.y. ]
>
> вместо "ALT" лучше указать бэкпортера "Ajrat"
>
>> ---
>> Дополнение к ранее присланной серии из двух патчей.
>>
>> Саша Левин на ревью запроса в stable@ указал, что patch 2/2 (5ed54896,
>> "fix a potential scan no APs") в одиночку вносит достижимый 
>> self-deadlock
>> по dev->mt76.mutex: путь удаления станции идёт под этим mutex (его берёт
>> ядровая mt76_sta_remove()), а добавленный там roc_abort_sync() делает
>> cancel_work_sync() по roc_work(), который тоже хочет этот mutex.
>
> Саша Левин вроде как не против [1] принять серию из 3х патчей в stable 
> 6.12.y ветку, подготовьте исправленную версию и отправьте туда.
>
> [1] https://lore.kernel.org/all/20260610-stable-reply-0014@kernel.org/#t

Апстрим по сути ещё не принял. Это только rc 7.1 из linux-next.
Саша пишет, что либо я докажу, что исправление стабильное, либо нужно 
ждать выпуска 7.1.
Ок, попробую доказать.

>
>> Этот коммит (d5059e52) — обязательное лечение, применять вместе с 2/2.
>> Таким образом серия теперь из трёх патчей.
>>
>>   drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c 
>> b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
>> index f2fffca868b51..99561094640f1 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
>> @@ -365,12 +365,15 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev)
>>   {
>>       struct mt792x_phy *phy = &dev->phy;
>>
>> +    if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
>> +        return;
>> +
>>       del_timer_sync(&phy->roc_timer);
>> -    cancel_work_sync(&phy->roc_work);
>> -    if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
>> -        ieee80211_iterate_interfaces(mt76_hw(dev),
>> -                         IEEE80211_IFACE_ITER_RESUME_ALL,
>> -                         mt7921_roc_iter, (void *)phy);
>> +    cancel_work(&phy->roc_work);
>> +
>> +    ieee80211_iterate_interfaces(mt76_hw(dev),
>> +                     IEEE80211_IFACE_ITER_RESUME_ALL,
>> +                     mt7921_roc_iter, (void *)phy);
>>   }
>>   EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync);
>>
>> -- 
>> 2.50.1
>> _______________________________________________
>> devel-kernel mailing list
>> devel-kernel@lists.altlinux.org
>> https://lists.altlinux.org/mailman/listinfo/devel-kernel
>



  parent reply	other threads:[~2026-06-11 11:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 10:44 ` Ajrat Makhmutov
2026-06-11 11:07   ` Vasiliy Kovalev
2026-06-11 11:11     ` Vasiliy Kovalev
2026-06-11 11:15     ` Ajrat Makhmutov [this message]
2026-06-11 11:59       ` Vasiliy Kovalev
2026-06-16 14:39         ` Ajrat Makhmutov
2026-06-17  7:43           ` Vasiliy Kovalev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f111be2-002b-4641-9fc4-8dededf9baef@altlinux.org \
    --to=rauty@altlinux.org \
    --cc=devel-kernel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git