diff options
| author | Morduan Zang <zhangdandan@uniontech.com> | 2026-04-24 04:55:17 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-04-28 03:51:14 +0300 |
| commit | adbe2cdf75461891e50dbe11896ac78e9af1f874 (patch) | |
| tree | effd44fdbeb4e7a0ce34fc3ed7f07e2c83d74127 /include/linux/mpage.h | |
| parent | 23f0e34c64acba15cad4d23e50f41f533da195fa (diff) | |
| download | linux-adbe2cdf75461891e50dbe11896ac78e9af1f874.tar.xz | |
net: usb: rtl8150: free skb on usb_submit_urb() failure in xmit
When rtl8150_start_xmit() fails to submit the tx URB, the URB is never
handed to the USB core and write_bulk_callback() will not run. The
driver returns NETDEV_TX_OK, which tells the networking stack that the
skb has been consumed, but nothing actually frees the skb on this
error path:
dev->tx_skb = skb;
...
if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) {
...
/* no kfree_skb here */
}
return NETDEV_TX_OK;
This leaks the skb on every submit failure and also leaves dev->tx_skb
pointing at memory that the driver itself may later free, which is
fragile.
Free the skb with dev_kfree_skb_any() in the error path and clear
dev->tx_skb so no stale pointer is left behind.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Morduan Zang <zhangdandan@uniontech.com>
Link: https://patch.msgid.link/E7D3E1C013C5A859+20260424015517.9574-1-zhangdandan@uniontech.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/mpage.h')
0 files changed, 0 insertions, 0 deletions
