netdev.vger.kernel.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


^ 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  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
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-07-20 15:54 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Kalle Valo, David S. Miller, Matthias Brugger, linux-wireless,
	netdev, linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, 18 Jul 2020 00:26:29 -0500 Navid Emamdoost wrote:
> 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>

Acked-by: Jakub Kicinski <kubakici@wp.pl>

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

* Re: [PATCH] mt7601u: add missing release on skb in mt7601u_mcu_msg_send
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-08-02 15:11 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Jakub Kicinski, David S. Miller, Matthias Brugger,
	linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel, emamd001, Navid Emamdoost

Navid Emamdoost <navid.emamdoost@gmail.com> wrote:

> 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>
> Acked-by: Jakub Kicinski <kubakici@wp.pl>

Patch applied to wireless-drivers-next.git, thanks.

880e21490be6 mt7601u: add missing release on skb in mt7601u_mcu_msg_send

-- 
https://patchwork.kernel.org/patch/11671657/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[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: Navid Emamdoost, Matthias Brugger, Jakub Kicinski, Kalle Valo,
	David S. Miller, linux-kernel

…
> +++ 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

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

end of thread, other threads:[~2020-08-02 15:11 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).