diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-12 02:56:33 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-31 06:46:25 -0700 |
commit | 7be8d4251bf71a7fad26344e37b3dd4e18cde4fa (patch) | |
tree | d7d7e3c2af27d56e5a3b608c2f41550043396169 /drivers/net/wireless | |
parent | f8f54929bd239bd875c1004c997b1ffc450a45f4 (diff) | |
download | linux-stable-7be8d4251bf71a7fad26344e37b3dd4e18cde4fa.tar.gz linux-stable-7be8d4251bf71a7fad26344e37b3dd4e18cde4fa.tar.bz2 linux-stable-7be8d4251bf71a7fad26344e37b3dd4e18cde4fa.zip |
rtlwifi: fix a potential NULL pointer dereference
[ Upstream commit 765976285a8c8db3f0eb7f033829a899d0c2786e ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/realtek/rtlwifi/base.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index ef9b502ce576..a3189294ecb8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -469,6 +469,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, |