Skip to content

Commit

Permalink
rtlwifi: fix a potential NULL pointer dereference
Browse files Browse the repository at this point in the history
In case alloc_workqueue fails, the fix reports the error and
returns to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
kengiter authored and Kalle Valo committed Apr 4, 2019
1 parent 2cd2b42 commit 7659762
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
/* <2> work queue */
rtlpriv->works.hw = hw;
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,
(void *)rtl_watchdog_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
Expand Down

0 comments on commit 7659762

Please sign in to comment.