diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2019-08-27 01:03:44 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-17 12:13:12 +0300 |
commit | c19fe3816ea3de9dcf1b702dbb2684d8ea47b21a (patch) | |
tree | e63ccaf0958c0bd40460f3ab31cd2f93b97a1c01 /drivers/net/wireless | |
parent | ce8c40a493937db8f358ec02cc54227eb1e02a67 (diff) | |
download | linux-c19fe3816ea3de9dcf1b702dbb2684d8ea47b21a.tar.xz |
rtlwifi: rtl_pci: Fix memory leak when hardware init fails
[ Upstream commit 8cc782cd997dc4eb3ac183228d563727884ba874 ]
If the call to hw_init() fails for any of the drivers, the driver will
leak memory that was allocated in BT coexistence setup. Technically, each
of the drivers should have done this free; however placing it in rtl_pci
fixes all the drivers with only a single patch.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Stable-dep-of: 905a9241e4e8 ("wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/realtek/rtlwifi/pci.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 83749578fa8b..8bda1104bda8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -1817,6 +1817,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw) if (err) { RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Failed to config hardware!\n"); + kfree(rtlpriv->btcoexist.btc_context); + kfree(rtlpriv->btcoexist.wifi_only_context); return err; } rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, |