From: Sean Wang Date: Tue, 7 Jul 2020 19:16:47 +0000 (+0800) Subject: mt76: mt7663u: fix potential memory leak in mcu message handler X-Git-Tag: v5.10.7~1943^2~19^2~34^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c876039e95559350ee101d4b6f6084d9803f2995;p=platform%2Fkernel%2Flinux-rpi.git mt76: mt7663u: fix potential memory leak in mcu message handler Fix potential memory leak in mcu message handler on error condition. Fixes: eb99cc95c3b6 ("mt76: mt7615: introduce mt7663u support") Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c index 54885ad..39cd7dd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c @@ -34,7 +34,6 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, ret = mt76u_bulk_msg(&dev->mt76, skb->data, skb->len, NULL, 1000, ep); - dev_kfree_skb(skb); if (ret < 0) goto out; @@ -43,6 +42,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, out: mutex_unlock(&mdev->mcu.mutex); + dev_kfree_skb(skb); return ret; }