mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] can: usb: fix a possible memory leak in esd_usb2_start_xmit
@ 2022-02-25  6:00 Hangyu Hua
  2022-02-25 15:56 ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Hangyu Hua @ 2022-02-25  6:00 UTC (permalink / raw)
  To: wg, mkl, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	thunder.leizhen
  Cc: linux-can, netdev, linux-kernel, Hangyu Hua

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@gmail.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


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

end of thread, other threads:[~2022-02-28  8:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25  6:00 [PATCH] can: usb: fix a possible memory leak in esd_usb2_start_xmit Hangyu Hua
2022-02-25 15:56 ` Marc Kleine-Budde
2022-02-28  2:05   ` Hangyu Hua
2022-02-28  7:51     ` Marc Kleine-Budde
2022-02-28  8:06       ` Hangyu Hua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®