From patchwork Tue Aug 7 06:18:06 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: 10558241 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 32EEA14E2 for ; Tue, 7 Aug 2018 06:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21BF1297BE for ; Tue, 7 Aug 2018 06:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1546229806; Tue, 7 Aug 2018 06:18:34 +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 5250C29803 for ; Tue, 7 Aug 2018 06:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388601AbeHGIbQ (ORCPT ); Tue, 7 Aug 2018 04:31:16 -0400 Received: from mail-dm3nam03on0118.outbound.protection.outlook.com ([104.47.41.118]:1880 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733061AbeHGIbQ (ORCPT ); Tue, 7 Aug 2018 04:31:16 -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=uiUG8zYjf7vX7Lovk0MQx3kGr1iAtUq62+ncnoWXBRQ=; b=Qf9xSNj55V+eDy3qz8JxISBQKxdfbjpDPaBdN2oKlqZv7VT2EVjrl+mJEyfplgqguDK+MuJV/PLfwxpxCBf35RmWJRLEPObhfHDWuw4u/yyxyvbzqrU3+JxYSP1qWQ9BEC/VopO4hDooQsuh8xE19ZEUi2AlQuf7ZvLF7t1ys6c= 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 BLUPR0601MB1426.namprd06.prod.outlook.com (2a01:111:e400:58c8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 06:18:28 +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 Subject: [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Date: Tue, 7 Aug 2018 01:18:06 -0500 Message-Id: <1533622686-145733-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: SN6PR06CA0024.namprd06.prod.outlook.com (2603:10b6:805:8e::37) To BLUPR0601MB1426.namprd06.prod.outlook.com (2a01:111:e400:58c8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 321f2ac8-612c-4d86-cb49-08d5fc2d9787 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:BLUPR0601M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6z/q4F3OacofcvEvU5sL73v/DnSbebsrE5dnGo7IBbrL2O2Zc6Bl0+x1h72bj7Rf+5gTw04cjHPSBWsgc18Jp6ATU0QuwWynT0jRL24yLvq6h5jcAaYQGCFwZAKkjvVeE/Q3E4gcQzl9jXxP13ClQC5cbsd54XVV83z7+sxWCiE62lUHM/wAdGB5zcs/9mYtk6bKNeo/zzF+QodUPAO+h/2bNyyBlteLmXCtBHIwB463Se/0uY2NIwG2AZhlH7NoGgtNooM/1y2DK7HUZBxLTDZEv2SK4m1dSKCpLgkOb2htFWhvQ90ClyCImTwoyE0/OMqN9/DUa0JtBFzBrI1D4z/a2FZw0LZ5NRqcu4MvNCZHaD4GDdBsuw6b4zaRgwIJkuWK7v4GJ;4:8ByFYW8w1kmjFoWjjDSJggDJ76wh8jIu4ZrMp0NOZD5/3JUQMMeRj7MoYMFQq7Fg0b2G/oPhFa6Lz2JFqPpHJo+emX3TboaXDFIt5CgQ96WnlFO99FelTgYpRQ/t/09QuQrFHj81HeAyYdyWuRXgrI1q/8COHgH4ynI5mo4KdgnFdiVnqLmg+ds8xcGAePjt3IJsc9wNHcGEXaGLnZ0+rsWJd23hFOjvAiz/nzdrbkNKbBHVvw/sR+OGyecYodlQFh7cJYqZyb2QhLCH7OOwycH9QM84WvzUqL1tWmUYfDeQMFR6cKmsD8M04U+uNYP/ 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)(10201501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:BLUPR0601MB1426;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0601MB1426; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(136003)(376002)(39850400004)(396003)(346002)(189003)(199004)(6916009)(72206003)(68736007)(36756003)(48376002)(50466002)(6486002)(5024004)(14444005)(2906002)(6666003)(3846002)(6116002)(7736002)(478600001)(107886003)(25786009)(316002)(16586007)(5660300001)(47776003)(4326008)(53936002)(305945005)(54906003)(97736004)(50226002)(26005)(2361001)(16526019)(86362001)(8676002)(81156014)(81166006)(1857600001)(386003)(66066001)(2351001)(105586002)(956004)(106356001)(52116002)(486006)(51416003)(7696005)(2616005)(476003)(186003)(8936002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0601MB1426;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;BLUPR0601MB1426;23:LGAW0W/oWkygt/VPXKt9KjGKXl8xEZ5pgJeM8e4wSOrbRb8TY88cQ+OHlSmsdn6mOSFP7GFYkVhY1EMgKDaHhP8l+NVEYrj61Ub7xVSUU69bEkmtYS7dxirgKV5J9Ck6szGUZX2mlzAkOIyhiM33qwB4A2DdgDFBb7JOOmEzAHTw5D5ZRbGh6M2ZVdYFKuGvsArC5Qvi2d+wwfNBcz3OYTDUGxp125UEK/Iy/juJng/gkmrD1uH4asr2Z7oulrsruNKo3BKKAqa02vA8YptU6NB5TlaVfkBrLpHHh8nQG5PC8fUMSmbZJN5Ar4dlCqTfVvrSARiubwqGHVnHEMIM/feTF2dhNRu5rQprP3eglcmZAcBa6UNGFXg7fD0X9ihNf+eYOkym/sm9kERqJayGrTpYoKIXDQsWd+BQb+TOWOeMjpydePEusx6twMf6vb6YRM3kJGOFgvorvsGHo1+Kl808Wa4TRwf6hJPLiyRfVC5Y/4NGWhRIbvFtji9bAXG+dOKWnrOWUpohBxkS9CWBFIfWzxYbjh8OtnXi4w1quyOLzPypsX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l4uI0Pya/H7Cc= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0601MB1426;6:UbJpeYuPmGFU8NgA3Bvs6t+TorSTKz39spEGZTW222N/t0qHyZ5JvfeOP6iIYRK7VdSQQPh0Iq7hm0uraSg/Y16Sooqrt9mrMS5qq9vyDIQfULhsh00XGgVoyC2wZWV5vw5W98zvBm+VkJO6raAmUclUloXWRVS3fRPQvm+LGcv6xDgNEvbi6aG4GFxwlLrH8HWjCwh8hXdPmahvC4coevnQ3ej33aB4mkF9c1b7x2RloauEaZlsv8eNIuTeuWxM5Iy6EOaRhm26nKB7DCLMe9GbwmGcJr8Dbg7xJeEYkvrl+3N40NVLgy+CkswKHRQMsYwJosS2Qjsgw3Vu/IqeeUsHVX5G4jdMqlFBMnAPl31YOj49nlOlivolWAsJoVcdPcG42lCQYzkIGdKuUV28tfPeywRw+pqVbzvZc98bNQ+80sXm/ICuibI6hjEZq1JiiKd0vtG91S1wwLfVS0Dy6A==;5:D5Ik/PtnM0ODlAy/ruDqdyxL9jZbQw1eWROk3xmmFdfqluWua5V3s9wpOnHvm6qN9WU4qpEP/iYhBrd4pL/dFYrg65y4NpWjZbuwNS7mX3qmhYfZb9jCXoNXiJaQEM4gq4OdCgnCUL0xknkNZIfvmISUkBC21Xis/y70/i9F+Vc=;7:LzB6VWuiJzBmGlEMOt1Bn1F1oUa7Om2zf9bLwDKtcMWEXdBrH+MB0E+4Ij/OYxZMb87Lio/b0PWpndaVJHIuHMU0BY0jAb9DYwrbNBn42P0VxZCVKzvQQePh0PcpplaOW16BpUZb8W5BaheHpE7Gba7DJZiWI/GEr18yIgDTgnI/lWOEgZDx+2gktDut6Y6g9tMa3a4NRPlKnsHD42aNM3Ze2eDintzD8ZAQf/DmXGHlg0gS5BpSig6eZAzT2urS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 06:18:28.3365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 321f2ac8-612c-4d86-cb49-08d5fc2d9787 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0601MB1426 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(). The kernel panic is introduced in below commit: commit id: 856d5a011c86b59f6564be4508912fb1d866adfc brcmfmac: allocate struct brcmf_pub instance using wiphy_new() Signed-off-by: Winnie Chang Reviewed-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 24c4e18..5444e62 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;