Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1775197pxp; Mon, 7 Mar 2022 02:02:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwosrmrJGB/hUdxkPLNq75/we2ROPKkk169B5vNkvBPK5PLk57Pyp8CGaNhOx8dkydRkS/3 X-Received: by 2002:a50:a6c2:0:b0:410:a328:3c86 with SMTP id f2-20020a50a6c2000000b00410a3283c86mr10402011edc.55.1646647333703; Mon, 07 Mar 2022 02:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647333; cv=none; d=google.com; s=arc-20160816; b=ZaCi5kZGzsglxfyOGHJEKr2Te/JW4KacmH1L5+hLuQwOymgzn33A0hKp+5Q9x99A9P NR4L4aFrhDIZLAMCfChrexqzM0uZK42UmKBGsTxJEQpPtjpADYpHfLa+8Elok62Ji7Dl jLVEwgPrlHvVP+n8F9bTVK5jO6ODMwoKhWpmIGBWHHFvC2DmZaQkFgODWiXcoyo/XlLA LlDwH7qEDE+vS9bzlYBQBL75tYUHqeP7UmY5eG4VGO1BknbjNJWQ2oERRawuMCF6MLys LIwTxudRnORy9mGYaoYwA4lOZUKPGnNcdIDr+BzgMXSPu2uJfOzOTa0oJaAOz9BKB84R aJYA== 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=t1FMAqDGcn4Ba0XxGlaS9MenvWvB8XMi18dmo5TF2Kc=; b=xysF61C7ehFf2j6zXsQB55cmZCXBQ3ZLAjXLLNy0VkWxvrEl/Ga8wW4p+Lz15UZDen cwFBiHRqhCEq11XoudjKi+trJpgKn7+bocsIK/z+jo4ym3vkfk2taF/FEjDE/kkrlr/I Ysv4z1+lkh/KdLOg97Kai+3tF/lGJWjfTlSCb6ZFLI597qtrcv/AwZJ+a7zWnWOj1rjR k5TTQreJmR8vtpd2jLH3ihzXBo6pBUtjN0Fi5hGkArC7JxtWB0sc5fZf+xXj4/bjqDYs KRhx6pMfKopeU1I6QkfVJd07ZFnEno59yXK6sxVJKVlWQN2FvOLTzI/v1pdm7fXFvzKa S6lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sdIEpxWQ; 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 g1-20020a1709065d0100b006db3fe2667dsi296977ejt.122.2022.03.07.02.01.50; Mon, 07 Mar 2022 02:02:13 -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=sdIEpxWQ; 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 S236612AbiCGJWg (ORCPT + 99 others); Mon, 7 Mar 2022 04:22:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236596AbiCGJWR (ORCPT ); Mon, 7 Mar 2022 04:22:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9520A6662A; Mon, 7 Mar 2022 01:20:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id 45507B81054; Mon, 7 Mar 2022 09:20:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 730FBC340E9; Mon, 7 Mar 2022 09:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644828; bh=tohyZRhddFOBEy3gO5lm9g2AbMMXdntkNRSQfG7NnjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sdIEpxWQvbf0i5E56MqkCPIx9lVSZYExpxQ/S9oVeLjnnX6bgEESLPOO9jCzzb/rk QHVsTBqGzj7ZsLbypMPYCFPkREkNYOLNLLoptw1Qk5ynSYLVtuw814JFBMjyEpuvRs rChmU8V3VyQcN7p6hyaDt4R3Ik+WNveV5+/ptn5U= 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.9 32/32] net: dcb: disable softirqs in dcbnl_flush_dev() Date: Mon, 7 Mar 2022 10:18:58 +0100 Message-Id: <20220307091635.351396827@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@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 @@ -1942,7 +1942,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) { @@ -1951,7 +1951,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,