Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw88: Free the H2C skb if PCI TX fails
@ 2026-12-04  9:44 Wanhui Fu
  2026-12-04 13:23 ` Luka Gejak
  0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-12-04  9:44 UTC (permalink / raw)
  To: pkshih, yhchuang, sgruszka, kvalo, briannorris; +Cc: linux-wireless, Wanhui Fu

rtw_tx_write_data_h2c_get() allocates an skb before calling
rtw_pci_tx_write_data(). If the ring is full or the mapping
fails, rtw_pci_tx_write_data() returns without queuing the
skb, causing a memory leak.

Free the skb if rtw_pci_tx_write_data() fails.

Found it by self-developed static analysis tool and compile-
test passed.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
 drivers/net/wireless/realtek/rtw88/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 66d2e5f51444..025b9c1502b2 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -906,6 +906,7 @@ static int rtw_pci_write_data_h2c(struct rtw_dev *rtwdev, u8 *buf, u32 size)
 	ret = rtw_pci_tx_write_data(rtwdev, &pkt_info, skb, RTW_TX_QUEUE_H2C);
 	if (ret) {
 		rtw_err(rtwdev, "failed to write h2c data\n");
+		dev_kfree_skb_any(skb);
 		return ret;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2026-12-04 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  9:44 [PATCH] wifi: rtw88: Free the H2C skb if PCI TX fails Wanhui Fu
2026-12-04 13:23 ` Luka Gejak

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