From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com,
Soul.Huang@mediatek.com, YN.Chen@mediatek.com,
Leon.Yen@mediatek.com, Eric-SY.Chang@mediatek.com,
Deren.Wu@mediatek.com, km.lin@mediatek.com,
jenhao.yang@mediatek.com, robin.chiu@mediatek.com,
Eddie.Chen@mediatek.com, ch.yeh@mediatek.com,
posh.sun@mediatek.com, ted.huang@mediatek.com,
Stella.Chang@mediatek.com, Tom.Chou@mediatek.com,
steve.lee@mediatek.com, jsiuda@google.com, frankgor@google.com,
kuabhs@google.com, druth@google.com, abhishekpandit@google.com,
shawnku@google.com, linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 1/2] mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap
Date: Mon, 25 Jul 2022 10:00:13 +0200 [thread overview]
Message-ID: <Yt5NjVwFXt205J5n@lore-desk> (raw)
In-Reply-To: <acb86f6ecd2f446e4102a2ef2e7a9c0003ae8b46.1658641200.git.objelf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]
> From: Sean Wang <sean.wang@mediatek.com>
>
> Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race
> with the context holding dev->muxtex and the driver might access the
> device in low power state.
>
> Fixes: 9d958b60ebc2 ("mt76: mt7921: fix command timeout in AP stop period")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7921/main.c | 21 ++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 1438a9f8d1fd..7a4a3ed1817e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1526,17 +1526,23 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> struct mt7921_dev *dev = mt7921_hw_dev(hw);
> int err;
>
> + mt7921_mutex_acquire(dev);
> +
> err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid,
> true);
> if (err)
> - return err;
> + goto failed;
>
> err = mt7921_mcu_set_bss_pm(dev, vif, true);
> if (err)
> - return err;
> + goto failed;
> +
> + err = mt7921_mcu_sta_update(dev, NULL, vif, true,
> + MT76_STA_INFO_STATE_NONE);
nit: maybe better "out" instead of "failed"
> +failed:
> + mt7921_mutex_release(dev);
>
> - return mt7921_mcu_sta_update(dev, NULL, vif, true,
> - MT76_STA_INFO_STATE_NONE);
> + return err;
> }
>
> static void
> @@ -1548,11 +1554,16 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> struct mt7921_dev *dev = mt7921_hw_dev(hw);
> int err;
>
> + mt7921_mutex_acquire(dev);
> +
> err = mt7921_mcu_set_bss_pm(dev, vif, false);
> if (err)
> - return;
> + goto failed;
>
> mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false);
> +
> +failed:
same here
> + mt7921_mutex_release(dev);
> }
>
> const struct ieee80211_ops mt7921_ops = {
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-07-25 8:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-24 8:58 [PATCH 1/2] mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap sean.wang
2022-07-24 8:58 ` [PATCH 2/2] mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload sean.wang
2022-07-25 8:10 ` Lorenzo Bianconi
2022-07-25 10:45 ` AngeloGioacchino Del Regno
2022-07-25 8:00 ` Lorenzo Bianconi [this message]
2022-07-25 10:44 ` [PATCH 1/2] mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap AngeloGioacchino Del Regno
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=Yt5NjVwFXt205J5n@lore-desk \
--to=lorenzo@kernel.org \
--cc=Deren.Wu@mediatek.com \
--cc=Eddie.Chen@mediatek.com \
--cc=Eric-SY.Chang@mediatek.com \
--cc=Leon.Yen@mediatek.com \
--cc=Soul.Huang@mediatek.com \
--cc=Stella.Chang@mediatek.com \
--cc=Tom.Chou@mediatek.com \
--cc=YN.Chen@mediatek.com \
--cc=abhishekpandit@google.com \
--cc=ch.yeh@mediatek.com \
--cc=druth@google.com \
--cc=frankgor@google.com \
--cc=jenhao.yang@mediatek.com \
--cc=jsiuda@google.com \
--cc=km.lin@mediatek.com \
--cc=kuabhs@google.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=posh.sun@mediatek.com \
--cc=robin.chiu@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shawnku@google.com \
--cc=steve.lee@mediatek.com \
--cc=ted.huang@mediatek.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.