Commit 8dc032a2 authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman

rtlwifi: fix a potential NULL pointer dereference

[ Upstream commit 76597628 ]

In case alloc_workqueue fails, the fix reports the error and
returns to avoid NULL pointer dereference.
Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f382ab1a
...@@ -448,6 +448,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) ...@@ -448,6 +448,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
/* <2> work queue */ /* <2> work queue */
rtlpriv->works.hw = hw; rtlpriv->works.hw = hw;
rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
if (unlikely(!rtlpriv->works.rtl_wq)) {
pr_err("Failed to allocate work queue\n");
return;
}
INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
(void *)rtl_watchdog_wq_callback); (void *)rtl_watchdog_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment