linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt7601u: add missing release on skb in mt7601u_mcu_msg_send
@ 2020-07-18  5:26 Navid Emamdoost
  2020-07-20 15:54 ` Jakub Kicinski
  2020-08-02 15:11 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Navid Emamdoost @ 2020-07-18  5:26 UTC (permalink / raw)
  To: Jakub Kicinski, Kalle Valo, David S. Miller, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: emamd001, Navid Emamdoost

In the implementation of mt7601u_mcu_msg_send(), skb is supposed to be
consumed on all execution paths. Release skb before returning if
test_bit() fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/mediatek/mt7601u/mcu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c
index af55ed82b96f..1b5cc271a9e1 100644
--- a/drivers/net/wireless/mediatek/mt7601u/mcu.c
+++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c
@@ -116,8 +116,10 @@ mt7601u_mcu_msg_send(struct mt7601u_dev *dev, struct sk_buff *skb,
 	int sent, ret;
 	u8 seq = 0;
 
-	if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
+	if (test_bit(MT7601U_STATE_REMOVED, &dev->state)) {
+		consume_skb(skb);
 		return 0;
+	}
 
 	mutex_lock(&dev->mcu.mutex);
 
-- 
2.17.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] mt7601u: add missing release on skb in mt7601u_mcu_msg_send
@ 2020-07-18 14:48 Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-07-18 14:48 UTC (permalink / raw)
  To: Navid Emamdoost, linux-arm-kernel, linux-mediatek,
	linux-wireless, netdev
  Cc: Jakub Kicinski, linux-kernel, Navid Emamdoost, Matthias Brugger,
	David S. Miller, Kalle Valo

…
> +++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c
> @@ -116,8 +116,10 @@ mt7601u_mcu_msg_send(struct mt7601u_dev *dev, struct sk_buff *skb,
>  	int sent, ret;
>  	u8 seq = 0;
>
> -	if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
> +	if (test_bit(MT7601U_STATE_REMOVED, &dev->state)) {
> +		consume_skb(skb);
>  		return 0;
> +	}
…

How do you think about to use the the following statements instead
in the if branch?

		ret = 0;
		goto consume_skb;


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

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

end of thread, other threads:[~2020-08-02 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-18  5:26 [PATCH] mt7601u: add missing release on skb in mt7601u_mcu_msg_send Navid Emamdoost
2020-07-20 15:54 ` Jakub Kicinski
2020-08-02 15:11 ` Kalle Valo
2020-07-18 14:48 Markus Elfring

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).