RE: [PATCH] rtl818x_pci: Fix potential memory leaks in rtl8180_init_rx_ring()
From: Ping-Ke Shih
Date: Fri Nov 14 2025 - 02:20:09 EST
Abdun Nihaal <nihaal@xxxxxxxxxxxxxx> wrote:
> In rtl8180_init_rx_ring(), memory is allocated for skb packets and DMA
> allocations in a loop. When an allocation fails, the previously
> successful allocations are not freed on exit.
>
> Fixes: f653211197f3 ("Add rtl8180 wireless driver")
> Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
> ---
> Compile tested only.
>
I'm surprised that people work on this old driver, and how did you find
this flaw?
It seems like rtl8180_free_rx_ring() does all things you are adding, so
just goto err_free_rings?
@@ -1130,7 +1131,7 @@ static int rtl8180_start(struct ieee80211_hw *dev)
ret = rtl8180_init_rx_ring(dev);
if (ret)
- return ret;
+ goto err_free_rings;
for (i = 0; i < (dev->queues + 1); i++)
if ((ret = rtl8180_init_tx_ring(dev, i, 16)))