RE: [PATCH v2] rtl818x_pci: Fix potential memory leaks in rtl8180_init_rx_ring()
From: Ping-Ke Shih
Date: Sun Nov 16 2025 - 22:43:52 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.
>
> Fix that by jumping to err_free_rings label on error, which calls
> rtl8180_free_rx_ring() to free the allocations. Remove the free of
> rx_ring in rtl8180_init_rx_ring() error path, and set the freed
> priv->rx_buf entry to null, to avoid double free.
>
> Fixes: f653211197f3 ("Add rtl8180 wireless driver")
> Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
Reviewed-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>