]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
rtlwifi: fix a potential NULL pointer dereference
authorKangjie Lu <kjlu@umn.edu>
Tue, 12 Mar 2019 07:56:33 +0000 (02:56 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 4 Apr 2019 10:24:53 +0000 (13:24 +0300)
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>
drivers/net/wireless/realtek/rtlwifi/base.c

index 217d2a7a43c74934744933dd0bf9f15bed7d4639..ac746c322554b393676f79f214b9fccdfddb3fda 100644 (file)
@@ -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,