From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 152E5C072B1 for ; Thu, 30 May 2019 04:47:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2C4425BEC for ; Thu, 30 May 2019 04:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559191667; bh=nyhqGap/iyJMPD77u2UuwgDx27f3z3dDq4hCBzjurb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QwCGUhspSHH6RIsGw84QREX6IjsWlcngozy+ylz34M3RUsHonW84lbXBLSWo6azgq uARrLJA4p1f3j8MY0rKED8EN2Qy7EC+galIJoxDgQmVLN/43PX6swpJP7oEdq3hkZY dc5toBGJ4zh2Mp7dLtLRkCJVMnSzB1DlAq9bUmNQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728821AbfE3Er0 (ORCPT ); Thu, 30 May 2019 00:47:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728562AbfE3DL2 (ORCPT ); Wed, 29 May 2019 23:11:28 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E81E24482; Thu, 30 May 2019 03:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559185888; bh=nyhqGap/iyJMPD77u2UuwgDx27f3z3dDq4hCBzjurb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uSq/31tMFpItNmjRKZB81yuy9i2X7BUbK1ZblS3pB+ySvvQQgF/vQnPyWnJ62TaTH ZfirzvMeX4VjkYo9HNfppaxGZzruhOo9Lgv0fvW2WTBuLfcz4g78f1rUxqCIbhPZFJ klLwZJNuCAATiqxoJQxVchZd/qJTj6CFvMR/mByo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Kalle Valo , Sasha Levin Subject: [PATCH 5.1 247/405] rtlwifi: fix a potential NULL pointer dereference Date: Wed, 29 May 2019 20:04:05 -0700 Message-Id: <20190530030553.485242665@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030540.291644921@linuxfoundation.org> References: <20190530030540.291644921@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ 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 Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtlwifi/base.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index 217d2a7a43c74..ac746c322554b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -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, -- 2.20.1