From patchwork Tue Aug 7 13:38:27 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: 10558727 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 24B8C13BB for ; Tue, 7 Aug 2018 13:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1363229E12 for ; Tue, 7 Aug 2018 13:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0737629E2F; Tue, 7 Aug 2018 13:39:07 +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 1C7AA29E12 for ; Tue, 7 Aug 2018 13:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389323AbeHGPx1 (ORCPT ); Tue, 7 Aug 2018 11:53:27 -0400 Received: from mail-bn3nam01on0096.outbound.protection.outlook.com ([104.47.33.96]:56064 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732639AbeHGPx1 (ORCPT ); Tue, 7 Aug 2018 11:53:27 -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=5EVWN4/KDs954yF5ZmRw+8yiZFrHqEGHn7yCa94s0P4=; b=KSVCY7EHsRkTHaaWyJQNw4nb290BqSNBLwgniu4thxljDsdlHekYat2Ogp2LRWCdkn+hhIBO1RfErDr8ExmHgTn6Vbur2n3jKkV4Il0oOYRfx1goZQN8jdCmesprOEod2f14rzSVs6EurieINyA2mYRCSIrPVDjPw3k7Pftr2Us= Received: from aremote05.aus.cypress.com (12.110.209.245) by BN3PR0601MB1430.namprd06.prod.outlook.com (2a01:111:e400:51d8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Tue, 7 Aug 2018 13:38:58 +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 v2] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Date: Tue, 7 Aug 2018 08:38:27 -0500 Message-Id: <1533649107-157808-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: SN4PR0201CA0064.namprd02.prod.outlook.com (2603:10b6:803:20::26) To BN3PR0601MB1430.namprd06.prod.outlook.com (2a01:111:e400:51d8::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e8b72c5-7c68-400e-2970-08d5fc6b20db 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:BN3PR0601MB1430; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0601MB1430;3:RlH/Rj/YLK53TXlicsBHR0DwbqrcYLjosR78LNJlklcmdlk3snuVfyGHiGOtTb4wLYHAhP+mknyX3vmMEYrT+jR9hCMbflPSNQnUaRL2/HVMFr3umywYQtjHAbLLo5jXwkHzIPIQaFpR1ep6SAc/G2EOY4EIoX/j0SLGCEhFDsDFv72iiZjThiHlspD8Qs7FQfHcKyrwLowLAlQMhr7zurgW0PIjGkBDe9He+Ytj0sqoRJnYZqpSKRacIwJmkFU+;25:JSWQBBdbAXNPKsVvrbi20q2Yd2x2f5flQw4OeSjYW6CxPFqZVktFf6Emz82S5Bgv26PP3ni25XKEIcQT9m5gMP0/e2/k0CQE+Q6150LQ0T2WOdOzr7IeqevsMZqSKsFjmAeuHF1IuMBu/LLa74LuR0tAyVjnRD3r9bR2obCTEb0bLUYgeubmfNlzp+J6+RulYAKigH5YA21PDlSexYMg6uhVAom//N5UNr7/wOmaawCn2e+Hav+VBsCxGZPixmeC39cKCLxhX0L75focK1Q2YWX5HL5rPMGi8aHcuvp94694TZQianh5FI68PP6BaBwWsmZCyPVWuqnIelIea7BCrw==;31:tuU2w97kYcBYs8EUsEYtrfoQFURbnhTnTgBeOPafy4hN5pmGMTm0AkGPrQF+6v5JO1fH44l/hqQZ0F02mgjGM5/l6zXt8wsAIFcrWrBCOOilV0cWiM4NIm5TonBhqHtLHmy5rLIzgglxnuD2G8c6h1suFdiew/RIsrfRnU24fGENGZ6k7zN+WbznF3QgPj6v+ztdL+FI+M204MR7DVkJPZrcPf0w23pc2VtRaBayPuk= X-MS-TrafficTypeDiagnostic: BN3PR0601MB1430: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0601MB1430;20:vSuIEPRGtNwwvbgNJ92spNRQMJ+688sFl6Cq7jn15NCUCOjzj/qR2eD9c38iys8QQ5+2G7UKifhCJ4uFY79LQ1iuy0/4ADX534v1me32CywN+LJJAl74JdcRMIAfHsDtUyeDl7tHJz/0U/yCkaaQYnFy3YpRgVzAeyRxdx0WfU+eZ41gCcWgs4DY/whCJIawWOE3WBQXsVsMlNlLYx4QPtlgtWdzsgmq6uvQE12C+9OlX5gGvqTQWUnoHK8npeRA/mzWuQagWOAU9FcwR9+hpNbVfLUnpkDbx5IQ8DpN2cBYvh0th5kdCGBEmAD/kGuXjUghf3/RLgdAbe+q/PO9MrX21nKAbDEQ31g6iGatJO0ymxT6ZfOboufHycnL/IZwayLOakhHRaNASEUPaVjjAzQPPZT7TJAbUSlDlLr/hb86CwmwU/3WiMA+CAywGSKETvak408wIgyZkKvbxr/01L7XKr+xQSctPw+EhkIAmX4q0oD1pWtn503sYE1B+NDd;4:P/E7ZzeDdpoSqf5jKPnTCL5p0UPAm9rHHh7GfZXFZbdzAONfy4guhuvUrKvwUYsEH2/hUBevUN3bYPM3Iasm5RD3AVWI6LsvDV14K/2kMe+VUcFPNEaBxHdMWYZezWwC/docSp0fwCtJ6Vgiy8R+jb3dYqKZybPdpB9FrdiKWq/c/+8rcF8SMkpjRugwJSLdLYOgks2BE4BhtB/BXNonPV7wSDloe4KXQRJojchZphGVt47EYZeSu4Cj8o7C7vkwD/VXBrlIdB41b+fPi+Jg76z9WFgyyI0Iqunzwfrhc8PSz+ne6U/dv0/Ni7xaQxLp 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)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:BN3PR0601MB1430;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0601MB1430; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(136003)(366004)(346002)(376002)(396003)(39860400002)(189003)(199004)(3846002)(6116002)(2616005)(186003)(52116002)(476003)(386003)(6666003)(478600001)(2351001)(8936002)(106356001)(105586002)(50226002)(16586007)(54906003)(72206003)(48376002)(50466002)(16526019)(6486002)(68736007)(97736004)(47776003)(51416003)(7696005)(316002)(53936002)(81156014)(81166006)(2906002)(8676002)(66066001)(14444005)(5660300001)(107886003)(5024004)(26005)(486006)(7736002)(4326008)(86362001)(25786009)(305945005)(956004)(2361001)(6916009)(36756003);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0601MB1430;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;BN3PR0601MB1430;23:+d90V/oLUeCWIrrsTRklFpxGVglcjDEnIhfKKkNT8jVng8IvLKqFrBxjWwhu7a8bLdBu/QUkUsNDPvbaMwZv8G7H6AWoJ06WjDIEIT8U2tEDUC8KDJhlB2bEgBkMElG8dMZztcU83KDk+BmXjNKTK57Ap5/KPZeCQditSD25b+DH07DmQWGhZt7ZWPubo7ajxTKjCpCHZ7tcJxvRRY0UbKe7sse7QOI0HKWDTNDlro6RxRdB45uunOEgNpqsDJEj8AJThMNSmiT7nk0rcOTxxfhEphLJNvjThghCooHNiHOFqxee7Kuz7QQ00QH6I+jjHMeuyCGjHYY9+xOPnT2XMlf0o8iLQKPwLOR1XDdqv6XhV3++Go9Fdjbl5vydmBdbUOpomOFq76nlIUa1Nufxijc+25tsL6FEgd9Tbc8uhWFIAcNMK4FAgIr7D+IF1v7pe0KZTqJ7tF/JYG3TTe/xDOcOpRTqUTkzUysJNVAOca7j/8xw/73qR6p+ODCdikpjDYKR94Lh14bOTXMBIK04WPq6VUw1uySFhTSEoXoxtaIrR4MtQ8ryZmV/y0SYZGZOiX1CqLhjzlK7Ll7vza0VaDTHFD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7nthgG83OdRwrKv9udCwj1aHUfGX2+NBvFjhPK14AT79Nqp3fu/rfyAPsBW8vaVMRklN+2YK/vlNo5h14Y845yOz7jAWyYdpu0GU2kP9csznis+4wCRsk8j4pWkGMBRF0Fn+KLjU5m1/ehVou9u/F1G9drwsGxbGP2P8IAtFzh+7BdpaFgEjf13fn8y3/uC4qKVZbWA3zqoKbssgLvv4Ce9hexF3UhfwgNzfaAasgyRMnPUv6ydON8LCBpsINmkkUWqLVLXxatChKac7nHl2SXlEzUbplfGru+wX5zBttf+3Z3AXnDY6EwvrdoaAF6CLuqHmK2LE/XXLNLVCryG8PUxBBKKgwuYcnaeCvhDeaAjUecvNTDL8Rayi00Rc3Orzzi9Jmb29tZLvGNm8qjkKO9ZMSaCHxsnb/hG/JETUd6IrOjHRqoYH0JUiAzNyAy9sTA==;5:6KqLRixIevZidrbpW7Ua77/pT5YKH4Ly72Jold4kUz43oiwGM34Lw7fYFz9Y89X8RdPCS72r6D8ZbrF/Ea5uF3MMawhWiLOg1EKABxcvwuXPWnLUFPAgH9rzCRNx+6PPEBs1ZXPWA3kLfBkJj80l5cZ0fzZOEg6sA+1urIvwH2E=;7:nq5n3dvA7vLMBa7UObDt180Pz1oApXRLN2rlJqeyf7zumL9d7W2GujflF/yx2SbSro7PQgK1354AJ9o8V2SIjHNL98777i5z1X68iDHUqvsBPofQ2NF0sVDH6YGwB4s9pdtwavY7AXT08NbAwZ4OJ0WDHerEGc7tl3v64cx8cp9ZTLOuc55KN6N1ruN/7mxaB9YiKvh9qb450Wy/XuUL9W+KeldkELSIZ4X4hLQ6rQs+R3mBU6zRgmKPB7kl+QoW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 13:38:58.0570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e8b72c5-7c68-400e-2970-08d5fc6b20db X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0601MB1430 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 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 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;