summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLuka Gejak <luka.gejak@linux.dev>2026-05-18 17:23:11 +0300
committerPing-Ke Shih <pkshih@realtek.com>2026-05-25 09:33:43 +0300
commit6b964941bbfe6e0f18b1a5e008486dbb62df440a (patch)
tree8b275f9d4659352054e678e063522839fe3c19ce /include/linux
parentc80788f7c5aed8d420366b821f867a8a353d83a5 (diff)
downloadlinux-6b964941bbfe6e0f18b1a5e008486dbb62df440a.tar.xz
wifi: rtw88: usb: fix memory leaks on USB write failures
When rtw_usb_write_port() fails to submit a USB Request Block (URB) (e.g., due to device disconnect or ENOMEM), the completion callback is never executed. Currently, the driver ignores the return value of rtw_usb_write_port() in rtw_usb_write_data() and rtw_usb_tx_agg_skb(). Because these functions rely on the completion callback to free the socket buffers (skbs) and the transaction control block (txcb), a submission failure results in: 1. A memory leak of the allocated skb in rtw_usb_write_data(). 2. A memory leak of the txcb structure and all aggregated skbs in rtw_usb_tx_agg_skb(). Fix this by checking the return value of rtw_usb_write_port(). If it fails, explicitly free the skb in rtw_usb_write_data(), and properly purge the tx_ack_queue and free the txcb in rtw_usb_tx_agg_skb(). The issue was discovered in practice during device disconnect/reconnect scenarios and memory pressure conditions. Tested by verifying normal TX operation continues after the fix without regressions. Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support") Cc: stable@vger.kernel.org Acked-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Luka Gejak <luka.gejak@linux.dev> Signed-off-by: Luka Gejak <luka.gejak@linux.dev> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260518142311.10328-2-luka.gejak@linux.dev
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions