From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3370F1099B30 for ; Fri, 20 Mar 2026 21:28:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E679141E77; Fri, 20 Mar 2026 21:28:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id agmAZWOm1lxp; Fri, 20 Mar 2026 21:28:48 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 06DF041E6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1774042128; bh=E26FYxc8wFxoRO3tK3QNRl4t1EimTsqjdbEJ3zG8sHM=; h=To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=MWj1MInkpKJ2Z4VkFHuVMGh6qdCv24p9KVgnOFhwBk6e5Wgc9F7uDkPtg3Qht1WZF zwH48S2IvQh3vgyu+A4tjggqxUUJBrRqyPUxEMnnRemyWmoxo+gHLh5vyvY8PZp3aw 8lrNQty02LJ7OaCrWJgkUsIHNFu/N5oG96Tx7XOvIXftesAwpagQAwMPywhSB7qYwe vM0eUmxbRINOlZzO+r6frLpY9u5W7svY8+iopoKlGRSw5S/jQ4i/E/yk3E2aqfuYE4 fxXYc2KGKA47JrM2BEijRhRPEHW+WshqqqpTOV+DLuNSsjzFQWi6ybtZACYqJECr1e U90+5sGUM44kw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 06DF041E6D; Fri, 20 Mar 2026 21:28:48 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id ADF0725C for ; Fri, 20 Mar 2026 21:28:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 93B9A848D2 for ; Fri, 20 Mar 2026 21:28:46 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ZEq5lhUSNE8T for ; Fri, 20 Mar 2026 21:28:45 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=199.89.1.16; helo=013.lax.mailroute.net; envelope-from=bvanassche@acm.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 7BD71848CB DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7BD71848CB Received: from 013.lax.mailroute.net (013.lax.mailroute.net [199.89.1.16]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7BD71848CB for ; Fri, 20 Mar 2026 21:28:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by 013.lax.mailroute.net (Postfix) with ESMTP id 4fcwfh2YFszlfpM6; Fri, 20 Mar 2026 21:28:44 +0000 (UTC) X-Virus-Scanned: by MailRoute Received: from 013.lax.mailroute.net ([127.0.0.1]) by localhost (013.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id X29t86ALwCta; Fri, 20 Mar 2026 21:28:40 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 013.lax.mailroute.net (Postfix) with ESMTPSA id 4fcwfY6FrrzlfvpL; Fri, 20 Mar 2026 21:28:37 +0000 (UTC) To: Tony Nguyen Cc: Przemek Kitszel , intel-wired-lan@lists.osuosl.org, Bart Van Assche , Aleksandr Loktionov Date: Fri, 20 Mar 2026 14:28:24 -0700 Message-ID: <20260320212824.264252-1-bvanassche@acm.org> X-Mailer: git-send-email 2.53.0.959.g497ff81fa9-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=mr01; t= 1774042120; x=1776634121; bh=E26FYxc8wFxoRO3tK3QNRl4t1EimTsqjdbE J3zG8sHM=; b=YJawdxt4oC9yp8KYDgd73MLR58EVim8aNX2V2S+m6t4aFOEq6Dv GkdfqqSnro2ZzmMUelIOfl2VbzOLX+HRTHM10Gn3bOEEEDM+dFBWpbDiAusnstiG jRrmeKlqPvllUQXw8/Gi3T5oUgcKDOHuP2po1sxJBeIk1FBmv/YdK/Q1XKglN2ZU 8n0oYYzXshDPCRmhK9yH/tqIXjzd/m8RaDqdYHXzeJ/Y4UzApdjAu8/4628OX7xQ IlHnP28KAfghKzwKkRgkci/7uKvksYSBK6/lFSV+9xPyABP5dtZ8pGbPFXw+3OIc WOCtJ86PFXikdQqDY1r1hA8Mlk+GyWRUMvA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=acm.org X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=YJawdxt4 Subject: [Intel-wired-lan] [PATCH iwl-net v4] ice: fix locking in ice_dcb_rebuild() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Bart Van Assche via Intel-wired-lan Reply-To: Bart Van Assche Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Move the mutex_lock() call up to prevent that DCB settings change after the first ice_query_port_ets() call. The second ice_query_port_ets() call in ice_dcb_rebuild() is already protected by pf->tc_mutex. This also fixes a bug in an error path, as before taking the first "goto dcb_error" in the function jumped over mutex_lock() to mutex_unlock(). This bug has been detected by the clang thread-safety analyzer. Cc: Aleksandr Loktionov Cc: intel-wired-lan@lists.osuosl.org Fixes: 242b5e068b25 ("ice: Fix DCB rebuild after reset") Signed-off-by: Bart Van Assche --- v4 (this patch): Changed "[PATCH] iwl-net:" into "[PATCH iwl-net]". v3 (2026-03-20): Modified patch description. See also https://lore.kernel.org/all/20260223220102.2158611-20-bart.vanassche@li= nux.dev/#t v2 (2026-02-23): Combined the two patches into one patch and increased the amount of code covered by tc_mutex. See also https://lore.kernel.org/all/20260223220102.2158611-20-bart.vanassche@li= nux.dev/ v1 (2025-02-06): Two patches. See also https://lore.kernel.org/all/20250206175114.1974171-16-bvanassche@acm.or= g/ drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/e= thernet/intel/ice/ice_dcb_lib.c index bd77f1c001ee..78ded6876581 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c @@ -537,14 +537,14 @@ void ice_dcb_rebuild(struct ice_pf *pf) struct ice_dcbx_cfg *err_cfg; int ret; =20 + mutex_lock(&pf->tc_mutex); + ret =3D ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); if (ret) { dev_err(dev, "Query Port ETS failed\n"); goto dcb_error; } =20 - mutex_lock(&pf->tc_mutex); - if (!pf->hw.port_info->qos_cfg.is_sw_lldp) ice_cfg_etsrec_defaults(pf->hw.port_info); =20