Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1775746pxp; Mon, 7 Mar 2022 02:02:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9EhT/wOtXoaEX8kxXvaEjXy7nMHYbAUL+kn2SJ3+k1zl3BCij0KW1QSLao0Ak4CcHPkcI X-Received: by 2002:a17:907:961c:b0:6da:68a5:426e with SMTP id gb28-20020a170907961c00b006da68a5426emr8834893ejc.188.1646647373474; Mon, 07 Mar 2022 02:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647373; cv=none; d=google.com; s=arc-20160816; b=JWWjQ98qH3Xq+cY7qwxwt/9dMwl85kriYZVPwR111k8PleCUXbLDM0kInEsWcipXf6 ujBfjPy0KA+bGq17zf0YMd9jY1wlEQ7Psp7wYow/s9iolSo+V9kogwGtpGyEFLhVXMda FY//VWDuYpQNNtxShfuIAhq0/zTwWanrtiOD3JbZwRBWWkXICJvqK2MVe5jgdo3U29YL UudpyDqL+RwOhMEp0Q/eUC9hyH/C+EQ3M+Spjp5mdlw23nUIlmG77gD8/RmGRv/Ah+70 EhIeEU3k6GrxpBzkAUDfTgyedkxVmiY3Jrs33DxNGk3hIV9Ux5+B4yCvyyD5EnGDrr5L BfHw== 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=1bVTU8HbHxaYxB9bWn05DCaFsgPSsLI3aR8ZJhsie8g=; b=aydCCsIDDZdJdZCl6E3S5Rq/1DY1zbjj3scm63SlwEuDP1bJ4xIWaK1QxPyrNCgmpT YnkUXIOCZUBDIjonmByTmuazojDw/mWAd3pPcS8WIkB5p9TU7p5mlhorncgLQKndi+d8 ukBdBUWpIq2ITchdeVA6S0FAqGLACP6WpfUYaWDzG8uiB8hH3DXHN/NUYEUFCOL3QWHB ztCNZci7udLFgw11zp3zob/sKaBmyPX+tdtb/uIGTGe/L9IsTJCmk3JM2TbDQTdcgYOd ikkwETlwmPkfCsJ5wkTk4HRIPR6w6Knz0YM3W20nbuOBw+WnD1CvW9f7Q+Bxa9LHme6/ T4Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="k9b//4Yu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt13-20020a170907728d00b006db2600ed06si2758964ejc.15.2022.03.07.02.02.31; Mon, 07 Mar 2022 02:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="k9b//4Yu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236808AbiCGJZY (ORCPT + 99 others); Mon, 7 Mar 2022 04:25:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237397AbiCGJX4 (ORCPT ); Mon, 7 Mar 2022 04:23:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F59B55233; Mon, 7 Mar 2022 01:23:03 -0800 (PST) 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 B8E9260C00; Mon, 7 Mar 2022 09:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7637C340E9; Mon, 7 Mar 2022 09:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644982; bh=li4VFgSXIxIex/M7aBlSQHnZ6KUc29ZHO1DTJscQqks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9b//4Yup6X9MKeHTuc4JNO+PU2d4NAE6/HAiD2AZdUs+0jQMoHFXi0aI5dI+vOQh gUoXG1yi9eJOmhcOk/smPjxD+aJZImlvpE+gP36ayM19pAGCtAfrGLwaXLjGbM4Q8r SRUyeqVj4vx/l2F00FCbzpY2IDQaF1c4oYm95EL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 4.14 42/42] net: dcb: disable softirqs in dcbnl_flush_dev() Date: Mon, 7 Mar 2022 10:19:16 +0100 Message-Id: <20220307091637.378320738@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.146155347@linuxfoundation.org> References: <20220307091636.146155347@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=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Vladimir Oltean commit 10b6bb62ae1a49ee818fc479cf57b8900176773e upstream. Ido Schimmel points out that since commit 52cff74eef5d ("dcbnl : Disable software interrupts before taking dcb_lock"), the DCB API can be called by drivers from softirq context. One such in-tree example is the chelsio cxgb4 driver: dcb_rpl -> cxgb4_dcb_handle_fw_update -> dcb_ieee_setapp If the firmware for this driver happened to send an event which resulted in a call to dcb_ieee_setapp() at the exact same time as another DCB-enabled interface was unregistering on the same CPU, the softirq would deadlock, because the interrupted process was already holding the dcb_lock in dcbnl_flush_dev(). Fix this unlikely event by using spin_lock_bh() in dcbnl_flush_dev() as in the rest of the dcbnl code. Fixes: 91b0383fef06 ("net: dcb: flush lingering app table entries for unregistered devices") Reported-by: Ido Schimmel Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220302193939.1368823-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/dcb/dcbnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1943,7 +1943,7 @@ static void dcbnl_flush_dev(struct net_d { struct dcb_app_type *itr, *tmp; - spin_lock(&dcb_lock); + spin_lock_bh(&dcb_lock); list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) { if (itr->ifindex == dev->ifindex) { @@ -1952,7 +1952,7 @@ static void dcbnl_flush_dev(struct net_d } } - spin_unlock(&dcb_lock); + spin_unlock_bh(&dcb_lock); } static int dcbnl_netdevice_event(struct notifier_block *nb,