[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220225060019.21220-1-hbh25y@gmail.com>
Date: Fri, 25 Feb 2022 14:00:19 +0800
From: Hangyu Hua <hbh25y@...il.com>
To: wg@...ndegger.com, mkl@...gutronix.de, davem@...emloft.net,
kuba@...nel.org, stefan.maetje@....eu, mailhol.vincent@...adoo.fr,
paskripkin@...il.com, thunder.leizhen@...wei.com
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Hangyu Hua <hbh25y@...il.com>
Subject: [PATCH] can: usb: fix a possible memory leak in esd_usb2_start_xmit
As in case of ems_usb_start_xmit, dev_kfree_skb needs to be called when
usb_submit_urb fails to avoid possible refcount leaks.
Signed-off-by: Hangyu Hua <hbh25y@...il.com>
---
drivers/net/can/usb/esd_usb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 286daaaea0b8..7b5e6c250d00 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -810,7 +810,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
usb_unanchor_urb(urb);
stats->tx_dropped++;
-
+ dev_kfree_skb(skb);
if (err == -ENODEV)
netif_device_detach(netdev);
else
--
2.25.1
Powered by blists - more mailing lists