diff mbox series

mt7601u: add missing release on skb in mt7601u_mcu_msg_send

Message ID 20200718052630.11032-1-navid.emamdoost@gmail.com (mailing list archive)
State Accepted
Commit 880e21490be68ef9cc8185962e9b5722a0f1fc4d
Delegated to: Kalle Valo
Headers show
Series mt7601u: add missing release on skb in mt7601u_mcu_msg_send | expand

Commit Message

Navid Emamdoost July 18, 2020, 5:26 a.m. UTC
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(-)

Comments

Jakub Kicinski July 20, 2020, 3:54 p.m. UTC | #1
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>
Kalle Valo Aug. 2, 2020, 3:11 p.m. UTC | #2
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
diff mbox series

Patch

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