mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
wifi: rtlwifi: destroy workqueue at rtl_deinit_core
[ Upstream commit d8ece6fc3694657e4886191b32ca1690af11adda ]
rtl_wq is allocated at rtl_init_core, so it makes more sense to destroy it
at rtl_deinit_core. In the case of USB, where _rtl_usb_init does not
require anything to be undone, that is fine. But for PCI, rtl_pci_init,
which is called after rtl_init_core, needs to deallocate data, but only if
it has been called.
That means that destroying the workqueue needs to be done whether
rtl_pci_init has been called or not. And since rtl_pci_deinit was doing it,
it has to be moved out of there.
It makes more sense to move it to rtl_deinit_core and have it done in both
cases, USB and PCI.
Since this is a requirement for a followup memory leak fix, mark this as
fixing such memory leak.
Fixes: 0c8173385e ("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-3-cascardo@igalia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1e39b0486c
commit
283bdc0ce7
@@ -575,9 +575,15 @@ static void rtl_free_entries_from_ack_queue(struct ieee80211_hw *hw,
|
|||||||
|
|
||||||
void rtl_deinit_core(struct ieee80211_hw *hw)
|
void rtl_deinit_core(struct ieee80211_hw *hw)
|
||||||
{
|
{
|
||||||
|
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||||
|
|
||||||
rtl_c2hcmd_launcher(hw, 0);
|
rtl_c2hcmd_launcher(hw, 0);
|
||||||
rtl_free_entries_from_scan_list(hw);
|
rtl_free_entries_from_scan_list(hw);
|
||||||
rtl_free_entries_from_ack_queue(hw, false);
|
rtl_free_entries_from_ack_queue(hw, false);
|
||||||
|
if (rtlpriv->works.rtl_wq) {
|
||||||
|
destroy_workqueue(rtlpriv->works.rtl_wq);
|
||||||
|
rtlpriv->works.rtl_wq = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rtl_deinit_core);
|
EXPORT_SYMBOL_GPL(rtl_deinit_core);
|
||||||
|
|
||||||
|
|||||||
@@ -1657,8 +1657,6 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
|
|||||||
synchronize_irq(rtlpci->pdev->irq);
|
synchronize_irq(rtlpci->pdev->irq);
|
||||||
tasklet_kill(&rtlpriv->works.irq_tasklet);
|
tasklet_kill(&rtlpriv->works.irq_tasklet);
|
||||||
cancel_work_sync(&rtlpriv->works.lps_change_work);
|
cancel_work_sync(&rtlpriv->works.lps_change_work);
|
||||||
|
|
||||||
destroy_workqueue(rtlpriv->works.rtl_wq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
|
static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
|
||||||
|
|||||||
@@ -679,11 +679,6 @@ static void _rtl_usb_cleanup_rx(struct ieee80211_hw *hw)
|
|||||||
tasklet_kill(&rtlusb->rx_work_tasklet);
|
tasklet_kill(&rtlusb->rx_work_tasklet);
|
||||||
cancel_work_sync(&rtlpriv->works.lps_change_work);
|
cancel_work_sync(&rtlpriv->works.lps_change_work);
|
||||||
|
|
||||||
if (rtlpriv->works.rtl_wq) {
|
|
||||||
destroy_workqueue(rtlpriv->works.rtl_wq);
|
|
||||||
rtlpriv->works.rtl_wq = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
skb_queue_purge(&rtlusb->rx_queue);
|
skb_queue_purge(&rtlusb->rx_queue);
|
||||||
|
|
||||||
while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) {
|
while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user