linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] mt76: mt76u: add missing release on skb in __mt76x02u_mcu_send_msg
@ 2020-07-18 15:20 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-07-18 15:20 UTC (permalink / raw)
  To: Navid Emamdoost, linux-arm-kernel, linux-mediatek,
	linux-wireless, netdev
  Cc: Navid Emamdoost, Ryder Lee, Matthias Brugger, Lorenzo Bianconi,
	Kalle Valo, Jakub Kicinski, Felix Fietkau, David S. Miller,
	linux-kernel

…
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
> @@ -111,6 +113,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
>  	if (wait_resp)
>  		ret = mt76x02u_mcu_wait_resp(dev, seq);
>
> +out:
>  	consume_skb(skb);
…

I suggest to use the label “consume_skb”.

Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

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

* [PATCH] mt76: mt76u: add missing release on skb in __mt76x02u_mcu_send_msg
@ 2020-07-18  5:47 Navid Emamdoost
  0 siblings, 0 replies; 2+ messages in thread
From: Navid Emamdoost @ 2020-07-18  5:47 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Kalle Valo,
	David S. Miller, Jakub Kicinski, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: emamd001, Navid Emamdoost

In the implementation of __mt76x02u_mcu_send_msg() the skb is consumed
all execution paths except one. Release skb before returning if
test_bit() fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
index a30bb536fc8a..e43d13d7c988 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
@@ -87,8 +87,10 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
 	u32 info;
 	int ret;
 
-	if (test_bit(MT76_REMOVED, &dev->phy.state))
-		return 0;
+	if (test_bit(MT76_REMOVED, &dev->phy.state)) {
+		ret = 0;
+		goto out;
+	}
 
 	if (wait_resp) {
 		seq = ++dev->mcu.msg_seq & 0xf;
@@ -111,6 +113,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
 	if (wait_resp)
 		ret = mt76x02u_mcu_wait_resp(dev, seq);
 
+out:
 	consume_skb(skb);
 
 	return ret;
-- 
2.17.1


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

end of thread, other threads:[~2020-07-18 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-18 15:20 [PATCH] mt76: mt76u: add missing release on skb in __mt76x02u_mcu_send_msg Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-07-18  5:47 Navid Emamdoost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).