Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp732018imm; Thu, 13 Sep 2018 06:59:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaVePy/O/qjGhvcP5Xqc1AIB2KuEl0/9RF5w08rGDtFUL063uUFhRg8flchxiPtVTwEkjkQ X-Received: by 2002:a63:144b:: with SMTP id 11-v6mr7150767pgu.219.1536847176022; Thu, 13 Sep 2018 06:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847175; cv=none; d=google.com; s=arc-20160816; b=uEz1pRJbFXqHZ26VqG0tn4TrCEbKZic3xQ0lnKBr3mqPR9tYVovN4kriK6NlA9bynz AO2q7DYAwDiWhkGYhqhs6GvgDPebfj687IZLuDrSt6fx4ooWPF8P00jU/VFwifoHa/0b CtNeuG01TfrvZgcvSHuFqc5llxgk5tEMdM3QRdQT/hdTRCahJ+95m8sH5mSGeFR2foul 09YIwhL7PZGzvZqWvJw9vnr2brUbDzpWTX2bDa1KpjsFlXBRrcMHR+uN5cmtm6REzxs3 4bLeG3OkHtpqE/bjxnZsVfrHzNtNmybj/lh3nuk+6v7V1JfXb3esVAgVsbVSdpeb5wMr xO2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=jFtR+fq3N/Mh7GU27ZpyA3zVw8tV/VNqCEyAAcvOVBI=; b=mTp8LWoHARXS8RabMTaAUTHGmmMf6zHtWnshOF73kzbQW7+lsKfUEOI3Cv/v6wWtkD 2mcS0Ku1ZvgYmwc1FbrQKrDI+xuTQXXZ06TPr5ya+0qnOYBHKr7bBotT7t9ynfRGzDIK xMMf9mnl8uER4tYbXzPUOQv80hhMCBMoLTNY3hDezwP9UAyYQd3zOkIbbZztkTzJ9SkX qf9mosadQrVHIQdImHvXIx+G3yaa7OFwzwpC14N3/sSLHK3/GnDp+SmlTEbf+TCQIK7p cYLvq50esU9L7t6JHDF25GDmvdfsxcx2UZfldHXM1k2VyKZZL/i9kRjAVXiDlWU/RY10 rPRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si3454684pgp.602.2018.09.13.06.59.20; Thu, 13 Sep 2018 06:59:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731514AbeIMTHX (ORCPT + 99 others); Thu, 13 Sep 2018 15:07:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34424 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbeIMTHX (ORCPT ); Thu, 13 Sep 2018 15:07:23 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 16D92D0E; Thu, 13 Sep 2018 13:57:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Winnie Chang , Chi-Hsien Lin , Kalle Valo , Sasha Levin Subject: [PATCH 4.18 102/197] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Date: Thu, 13 Sep 2018 15:30:51 +0200 Message-Id: <20180913131845.625470873@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Winnie Chang [ Upstream commit 27a8aea13053700ad2a08189024df7e341d1ee51 ] The kernel BUG happens when wowl is enabled from firmware. In brcmf_wiphy_wowl_params(), cfg is a NULL pointer because it is drvr->config returned from wiphy_to_cfg(), and drvr->config is not set yet. To fix it, set drvr->config before brcmf_setup_wiphy() which calls brcmf_wiphy_wowl_params(). Fixes: 856d5a011c86 ("brcmfmac: allocate struct brcmf_pub instance using wiphy_new()") Signed-off-by: Winnie Chang Signed-off-by: Chi-Hsien Lin Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -6926,15 +6926,15 @@ struct brcmf_cfg80211_info *brcmf_cfg802 cfg->d11inf.io_type = (u8)io_type; brcmu_d11_attach(&cfg->d11inf); - err = brcmf_setup_wiphy(wiphy, ifp); - if (err < 0) - goto priv_out; - /* regulatory notifer below needs access to cfg so * assign it now. */ drvr->config = cfg; + err = brcmf_setup_wiphy(wiphy, ifp); + if (err < 0) + goto priv_out; + brcmf_dbg(INFO, "Registering custom regulatory\n"); wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;