public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
@ 2024-09-29 19:53 Christophe JAILLET
  2024-10-01 19:08 ` Markus Elfring
  2024-11-18  6:03 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-09-29 19:53 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-wireless,
	linux-arm-kernel, linux-mediatek

If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as
done in the other error handling path of mt7915_add_interface().

Fixes: f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index d75e8dea1fbd..bea8b77b1b92 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -246,8 +246,10 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
 	phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
 
 	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, mt7915_wtbl_size(dev));
-	if (idx < 0)
-		return -ENOSPC;
+	if (idx < 0) {
+		ret = -ENOSPC;
+		goto out;
+	}
 
 	INIT_LIST_HEAD(&mvif->sta.rc_list);
 	INIT_LIST_HEAD(&mvif->sta.wcid.poll_list);
-- 
2.46.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
  2024-09-29 19:53 [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface() Christophe JAILLET
@ 2024-10-01 19:08 ` Markus Elfring
  2024-11-18  6:03 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2024-10-01 19:08 UTC (permalink / raw)
  To: Christophe Jaillet, linux-mediatek, linux-wireless,
	linux-arm-kernel, Angelo Gioacchino Del Regno, Felix Fietkau,
	Kalle Valo, Lorenzo Bianconi, Matthias Brugger, Ryder Lee,
	Sean Wang, Shayne Chen
  Cc: kernel-janitors, LKML

> If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as
> done in the other error handling path of mt7915_add_interface().

                                   paths?


…
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -246,8 +246,10 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
>  	phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
>
>  	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, mt7915_wtbl_size(dev));
> -	if (idx < 0)
> -		return -ENOSPC;
> +	if (idx < 0) {
> +		ret = -ENOSPC;
> +		goto out;
> +	}
…

Would you dare to support another jump target for this assignment statement?

Regards,
Markus


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
  2024-09-29 19:53 [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface() Christophe JAILLET
  2024-10-01 19:08 ` Markus Elfring
@ 2024-11-18  6:03 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-11-18  6:03 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-kernel, kernel-janitors,
	linux-wireless, linux-arm-kernel, linux-mediatek

On Sun, Sep 29, 2024 at 09:53:40PM +0200, Christophe JAILLET wrote:
> If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as
> done in the other error handling path of mt7915_add_interface().
> 
> Fixes: f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

This fix is still required.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-18  6:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 19:53 [PATCH] wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface() Christophe JAILLET
2024-10-01 19:08 ` Markus Elfring
2024-11-18  6:03 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox