]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: rtl818x: Fix potential memory leaks in rtl8180_init_rx_ring()
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>
Fri, 14 Nov 2025 09:45:26 +0000 (15:15 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:04 +0000 (14:03 +0100)
commitc9d1c4152e6d32fa74034464854bee262a60bc43
treebbf81daafa278ef77945ce96a0ac5feedb3ea05d
parent9ea941e8bba68f9cefd4ed18663a3a8c85e836e1
wifi: rtl818x: Fix potential memory leaks in rtl8180_init_rx_ring()

[ Upstream commit 9b5b9c042b30befc5b37e4539ace95af70843473 ]

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@cse.iitm.ac.in>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251114094527.79842-1-nihaal@cse.iitm.ac.in
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c