]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: rtlwifi: fix memory leaks and invalid access at probe error path
authorThadeu Lima de Souza Cascardo <cascardo@igalia.com>
Fri, 6 Dec 2024 17:37:12 +0000 (14:37 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:49:55 +0000 (12:49 +0100)
commitb96371339fd9cac90f5ee4ac17ee5c4cbbdfa6f7
tree1e67dd691224b835aeed98655e0d9abe81f2548e
parent0eea81f30c6e584656acb30f64cb6fbe5f254315
wifi: rtlwifi: fix memory leaks and invalid access at probe error path

[ Upstream commit e7ceefbfd8d447abc8aca8ab993a942803522c06 ]

Deinitialize at reverse order when probe fails.

When init_sw_vars fails, rtl_deinit_core should not be called, specially
now that it destroys the rtl_wq workqueue.

And call rtl_pci_deinit and deinit_sw_vars, otherwise, memory will be
leaked.

Remove pci_set_drvdata call as it will already be cleaned up by the core
driver code and could lead to memory leaks too. cf. commit 8d450935ae7f
("wireless: rtlwifi: remove unnecessary pci_set_drvdata()") and
commit 3d86b93064c7 ("rtlwifi: Fix PCI probe error path orphaned memory").

Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241206173713.3222187-4-cascardo@igalia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtlwifi/pci.c