[PATCH 2/2] mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload

Lorenzo Bianconi lorenzo at kernel.org
Mon Jul 25 01:10:55 PDT 2022


> From: Sean Wang <sean.wang at 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: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload")
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>

Acked-by: Lorenzo Bianconi <lorenzo at kernel.org>

> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 7a4a3ed1817e..0d1b17e439dc 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1404,6 +1404,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
>  	struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
>  	struct mt7921_dev *dev = mt7921_hw_dev(hw);
>  
> +	mt7921_mutex_acquire(dev);
> +
>  	if (enabled)
>  		set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
>  	else
> @@ -1411,6 +1413,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
>  
>  	mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid,
>  					     MCU_UNI_CMD(STA_REC_UPDATE));
> +
> +	mt7921_mutex_release(dev);
>  }
>  
>  #if IS_ENABLED(CONFIG_IPV6)
> -- 
> 2.25.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20220725/5c9ba9f2/attachment-0001.sig>


More information about the Linux-mediatek mailing list