From patchwork Wed Aug 8 02:19:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 10559407 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 153A713B4 for ; Wed, 8 Aug 2018 02:20:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDB911FF65 for ; Wed, 8 Aug 2018 02:20:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2962A638; Wed, 8 Aug 2018 02:20:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 884671FF65 for ; Wed, 8 Aug 2018 02:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726724AbeHHEh0 (ORCPT ); Wed, 8 Aug 2018 00:37:26 -0400 Received: from mail-sn1nam01on0116.outbound.protection.outlook.com ([104.47.32.116]:61705 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726158AbeHHEh0 (ORCPT ); Wed, 8 Aug 2018 00:37:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cycorp.onmicrosoft.com; s=selector1-cypress-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=alx/hkW9pwzAKeAs5zcU2JOTtEWcxOztHUlTyXQ6/yU=; b=lwvtt1yAIkzV50IC2/+ghN2HWIxdCFJzRPirTiUBDHs6BrcxyGGT3GItRABZTGtiHsxMUgJRLxjFyxIZ4NJgwWJ3ps6EuiqLOJuQ3SwC6VHAxasZnP19RzSvSYq8N4WcJreonwcMZ+seaHSQIDY+gVtE57LMvaGqMWITOWWs4Y8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from aremote05.aus.cypress.com (12.110.209.245) by CY1PR0601MB1439.namprd06.prod.outlook.com (2a01:111:e400:528b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 02:20:05 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Winnie Chang , Chi-Hsien Lin Subject: [PATCH v3] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Date: Tue, 7 Aug 2018 21:19:41 -0500 Message-Id: <1533694781-176974-1-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 X-Originating-IP: [12.110.209.245] X-ClientProxiedBy: SN6PR04CA0005.namprd04.prod.outlook.com (2603:10b6:805:3e::18) To CY1PR0601MB1439.namprd06.prod.outlook.com (2a01:111:e400:528b::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71b0f50c-eb38-4c22-481b-08d5fcd574c2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR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PmI3xUJrhnDr4YuLnbanqxoKGXeQHbuVpFZ6345lzPZxP4seLtqmDQkJKyw91vt54yIchH0pimZdjaAK36WFWbUy6YJdCvo+FYADPo0YAW4J92/oINF/7VMVHE36EDdPa84j+3XTd153+B13+JXHjbDvXijZv+RwNIuEqHRM91pSsmp9fp0uSXc3f5cZShWUszv2SqYrfEFI5qKZ35ipnYTCp/yaUE+xnDVZ0Wv7MwVtWDJg9o5fWdbxE4Y7D7eqdLSg4RO2BgQS3BRq8LfDuhZ1zx0+07FXzinJJGpMoeZ5G2EvZEWvP4cP7iqxC0lbaUDql5h5xKfm++u8kbpLZMH2074vf44WTC2RTlauuit/8Hv1uuNfh9XTNkVP4tfmovSvkipc0L2XrS5s2te0nFB8xfaWs35;4:95KN9L94l2tzDab606/1bv8iH29OEjS1yZNEK1lrwzoyLBKQMWuHIl+CGgUYZPxCAgtysW9za6g24HzDk1qzTzAakp3Wxt354rF5zmEAILhVHHRMRPki2qlvjAA9gX2f/9rxoPxUkDHJBaNVcc/ToTUaRj1QKHX+sMR2wYKPDbO6QVTd/3R36G4ZDuiIrAyi8dIAV7/+ydb2fQOVYHIw3rGvRz/SY2gxp3sRKSosHn6JvvBvgjq2XmDvW6B9ruC0EQ3bLbroYPSSL2pLMfCu0UHDISVq5T9HWdgnbhJWmw9mUdsM3t6Zo15EehTwQvz/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(258095267146985); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:CY1PR0601MB1439;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0601MB1439; X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(136003)(376002)(39860400002)(346002)(366004)(396003)(189003)(199004)(72206003)(478600001)(7736002)(25786009)(5660300001)(50226002)(6486002)(107886003)(4326008)(51416003)(52116002)(316002)(7696005)(81166006)(81156014)(305945005)(16586007)(105586002)(8676002)(2361001)(53936002)(106356001)(68736007)(2351001)(50466002)(6916009)(8936002)(476003)(97736004)(956004)(6116002)(14444005)(36756003)(186003)(86362001)(48376002)(2906002)(54906003)(386003)(66066001)(2616005)(486006)(47776003)(3846002)(5024004)(26005)(6666003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0601MB1439;H:aremote05.aus.cypress.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;CY1PR0601MB1439;23:LrSg+oOwrQxWZhpmxS5wI1u4tjTs/7Ht8iVv30oVdXNmd17xCexk2EMMi8l13BOsJEn1c7KX8ZjTmtbZ29fbRr1uEoSV+XNJ1UxTqlWJAuuZFGXeTSDe9Anq3ctKva1xFkBnKY/mBjMQ0o+QsvjpmD03AlMTxqioDc2ioBGXbrztGnuc5ulkZLwJlO82IKEH7cdd6woQd51D16Q8KdklzXEGwMh6ztCVPn3T9BYScOudtH25yGEQOYrYewUN+iGpiLGhWUeOz98CvPNGPr71G0RBVpizCiyO8IAGCh2niwA2xHYszQQHN2JVreLCOu7vyg4AXv15OYJQMoeMZrjFX7LLmJ8YnD5y+qIU6fbJsC87md4X2GT7gBg7pzNDw17uH8PCWVS3G6GtOp9doVifPsBvcgwAvxsmApRd0txA+k4O5dzYE48LPRFNm44xWF3sJMZle9HnteETbEZxZSQT7d1U7HoYxQ7KMu7aGb5TYd/2gfrIfE7521Y1t+AxU2jX8BbheBGPlnVQXdFaFGZVLyRIR0tJMUn184f+O26auGVHEiJNnhnpJd0mjOQ/p7Co7W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jx18oXjJw6kEjzl4x6Fo+QK/uEjUSSUhSKzs/mRv/eK+vwJjwsuQqNZ8j+M5c7LO0PpnFZlfInR/tgJpmJlwTP5w9xu7qLta25bD83lcUw871QfpJ+atTzVaRwf9KJxwUi8/NIWrGpCvbVBnvq22s2YKTzZVRWOa1mkpL3ru/R1r9pJQ1lGO5QTf8Hn+9S+NU9o3ZGzdSOFARyB336OZGG2fXd97cMtzcjLB2+uK4YOBL06GoXxhlCrrxiIy54eCDtw5uUfdIq9LLH6WvPo9cfG25Vw39P8+Xx8whWy/l5gdTEh7N6EA7Eb7PyOAT6I6klqdSmlIhexaoBw/v52DeCpbynss8+5fz3gQNZajFaYoeRWoXvEIShCXunRfAyF75vto77SU1EUmkTpAtZKjlXUAzNl6jKMyGCkmEUiqiMtt+50zmYSRUF/YSsOmWSOtNlyOFGIBwrGoJDKJiGXaXA==;5:M5UC3kYZzlrYk11x0h99HnSbocPUyXXovs99SqKrQcwJNlKVTwZV4UDzmAwkdn30x8+LNwXBE3R5ruMfM4FY3cwnoEzCxMBGII1GOkALqNeuJ50qzb7nMWUrHpAZOxNBd/dFFQpP9XyYl8nhs7hIR87ybSMcPTRtLdiia+1wDQ8=;7:MyaxUPqJX0nvcEpAG9ROQXFCQ1eK75vDAq+Ruyxc7+c8zk7nvjx1BLRLknmLzW+CFXdoIwshZmPsmhoieFoYpH+gE5sy6b4GwFe5vdGC3jsXaahKHmJwplPKJKgVRly2451kZZHiSVxvWmE8nBofqcSM8gJCtAw1cYLcYFFo9pM0YslCZr+qTe2uCukVfHZmjrtqLgOcK2Eh/m/1Zwoonidd1Taq3zoTQVzJAH08eBbRVfcy1KkftKPivBrJkEIg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 02:20:05.5132 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71b0f50c-eb38-4c22-481b-08d5fcd574c2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0601MB1439 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Winnie Chang 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 --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 24c4e18e7d80..5444e6213d45 100644 --- 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_cfg80211_attach(struct brcmf_pub *drvr, 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;