Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp605240pxb; Tue, 5 Apr 2022 15:42:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgpPVOXBrcM5N/fc5EXYQKg0XoMXYDIjTmf+cZCsrIsnSD7rUPSJyu6sugyG+Mvf/lxMKK X-Received: by 2002:a63:2058:0:b0:399:24bb:77d3 with SMTP id r24-20020a632058000000b0039924bb77d3mr4598729pgm.412.1649198562039; Tue, 05 Apr 2022 15:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649198562; cv=none; d=google.com; s=arc-20160816; b=OIZA45mqQhPqK0fd1vUvJXKrBlO2lw+NWB/3xB+UAcZvpM4eE9kAWrvGEX+/ypbcOK adtTbVA2Td8Z/28tf8UTDWZrdL929O/5DgZohA3GnRUbF6ALE8/vJKbiEI151l2QCUaV /CckEbFi/R3cDoKeDcr3XTqfK++M6wwJ9fGIOULGPJ0/upGDVEqAmjsE0Cf+nGfrITcZ rqLTV88HzbixiE3LXrAOT4guBRkdfhIWWLAvh6IBL1SSVBjnJ0p2f7n3pHrAqPCfDYSM dgJpgYKKf9Amx2TCh8cQam9IXIidkhwEAk+x7hcJjKxQxu6mpauWGE9McuhImdSEAhXa 7bLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sDOE9eVJBwPDMm8xnQgv8VgFN7A/dfwwOF7TqVDsyh0=; b=sQjuOcufWOWAAMeSIkA9cCqlQUsgmWmSum6gv9E7ysdsiQ9E5Me4etA9LIb8iH4jLq hSyI17XLD0IedlDA2SbpCBeO68Q16k3cvgeM5ftSpzfLzYOJAwTaBxs4t3bqXGME/lOO Vz9DH+9+pRTPTuXe10C8aWzAQbtgHFljxN1Xlw/CHp+wtc0PgHFf1tuYg+7rYftJ6+Bz Id+JsiVuXvT+jfyvmAGDtZiaZPMsizAorQzVn0fl+QuiyBpAWq86bTApFlKHWXyu1wkn jveerUZVVBaHstEpdBDtATFqgDEK3pBI3ih9vm843BMswRboS9iBIPUbMg8Vj9yU5i8a iAMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0yJsQWc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j6-20020a170903024600b00153b2d16442si14538081plh.74.2022.04.05.15.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0yJsQWc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84BD65BD18; Tue, 5 Apr 2022 15:23:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353011AbiDEMIq (ORCPT + 99 others); Tue, 5 Apr 2022 08:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244197AbiDEIvt (ORCPT ); Tue, 5 Apr 2022 04:51:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF2ED3AE2; Tue, 5 Apr 2022 01:40:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8083861003; Tue, 5 Apr 2022 08:39:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9028CC385A0; Tue, 5 Apr 2022 08:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147985; bh=Zx4lWtvKcRuOo75kaWAnuXqPkXeLmjn2MI0+fP+jJTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yJsQWc3PYmxcQs91Vudk9kiKJ8rkSC5xIQ8xLwWSj66RvwydOECdXIPa7xTyrgO3 C8bmHCBsbWUaqPaBgKzrlpzXtDZPwNU353YOZHkeqzcnIJPTf7DZLlgCPp7aJpU/8l jmUAfhGEnQZ1LTnPl0Bset8EibSuKbOii9MgE7rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Arend van Spriel , Hector Martin , Andy Shevchenko , Kalle Valo Subject: [PATCH 5.16 0194/1017] brcmfmac: pcie: Fix crashes due to early IRQs Date: Tue, 5 Apr 2022 09:18:27 +0200 Message-Id: <20220405070400.003319251@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin commit b50255c83b914defd61a57fbc81d452334b63f4c upstream. The driver was enabling IRQs before the message processing was initialized. This could cause IRQs to come in too early and crash the driver. Instead, move the IRQ enable and hostready to a bus preinit function, at which point everything is properly initialized. Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.") Reviewed-by: Linus Walleij Reviewed-by: Arend van Spriel Cc: stable@vger.kernel.org Signed-off-by: Hector Martin Reviewed-by: Andy Shevchenko Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220131160713.245637-7-marcan@marcan.st Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1315,6 +1315,18 @@ static void brcmf_pcie_down(struct devic { } +static int brcmf_pcie_preinit(struct device *dev) +{ + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; + + brcmf_dbg(PCIE, "Enter\n"); + + brcmf_pcie_intr_enable(buspub->devinfo); + brcmf_pcie_hostready(buspub->devinfo); + + return 0; +} static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb) { @@ -1423,6 +1435,7 @@ static int brcmf_pcie_reset(struct devic } static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .preinit = brcmf_pcie_preinit, .txdata = brcmf_pcie_tx, .stop = brcmf_pcie_down, .txctl = brcmf_pcie_tx_ctlpkt, @@ -1795,9 +1808,6 @@ static void brcmf_pcie_setup(struct devi init_waitqueue_head(&devinfo->mbdata_resp_wait); - brcmf_pcie_intr_enable(devinfo); - brcmf_pcie_hostready(devinfo); - ret = brcmf_attach(&devinfo->pdev->dev); if (ret) goto fail;