From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A7A33A9DA; Sat, 30 May 2026 17:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162438; cv=none; b=NDB1yBrd8GJnFAA0HKBBujtGLunGiQGsxZjjQ69/H6Ry/50TsNYKD84flR17yZqd2uovutlevvqjvEAIwnm8iCXvhYdxrNkxbDYzsDFtWmiR3iMwz+c/y0olBtoFFIevF0qVFJnGGH5WjRO9TkHDO9DhvY0MTTh4UL1ErVsaP40= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162438; c=relaxed/simple; bh=XBbHwBZNO69CF4MTLoX/Nl3+/urS26gWQhObAaPPab8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dxYdbz4xslTa8D9WeY65XdaFwPLvrRBNnKlv8ckqn8BLBA3xHzZhaSKvLNyJkpevD4FYzRk+JSIlaPQi4GRq3nJNVuyZMnw5PimwdKC+AHYDm+ipU12G45QtXftliAgxlgElVCLMi2xHwssnK5u+oIEpMbnJenwtRB5CII2PqNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=P9howm58; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="P9howm58" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE42D1F00893; Sat, 30 May 2026 17:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162437; bh=NeXlS2Ir8d1jmxgQa/mSAeKxhRzYevgazF56ts0MqqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P9howm58sgMtslxTSjqfOb3HMKqUDik2WZD2vepZxozzVdkhHT2Kv+YIt17CGHY+K U6lZ6jTQl1VTlQVBmeU7D8SUaG2vStOocKYXunKg1ryb9rBKbMHN2O0jMmYwRoUHZ5 j7GZbb8x9CNuldVBkStxcjed/ThXUWbOEQpFW4ko= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, intel-wired-lan@lists.osuosl.org, Bart Van Assche , Aleksandr Loktionov , Przemek Kitszel , Arpana Arland , Jacob Keller , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 921/969] ice: fix locking in ice_dcb_rebuild() Date: Sat, 30 May 2026 18:07:25 +0200 Message-ID: <20260530160326.170163059@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit 0ded1f36ba4021cba50513e80be6b6e173710168 ] 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: intel-wired-lan@lists.osuosl.org Fixes: 242b5e068b25 ("ice: Fix DCB rebuild after reset") Signed-off-by: Bart Van Assche Reviewed-by: Aleksandr Loktionov Reviewed-by: Przemek Kitszel Tested-by: Arpana Arland Signed-off-by: Jacob Keller Link: https://patch.msgid.link/20260506-jk-iwl-net-2026-05-04-v2-6-a5ea4dc837a9@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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/ethernet/intel/ice/ice_dcb_lib.c index 9aa0437aa598e..cc097207cf97f 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c @@ -530,14 +530,14 @@ void ice_dcb_rebuild(struct ice_pf *pf) struct ice_dcbx_cfg *err_cfg; int ret; + mutex_lock(&pf->tc_mutex); + ret = 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; } - mutex_lock(&pf->tc_mutex); - if (!pf->hw.port_info->qos_cfg.is_sw_lldp) ice_cfg_etsrec_defaults(pf->hw.port_info); -- 2.53.0 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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 A9C9FCD6E49 for ; Sat, 30 May 2026 17:34:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 676E56F5D8; Sat, 30 May 2026 17:34:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UXPa0WtS8tY9; Sat, 30 May 2026 17:34:00 +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 smtp3.osuosl.org 965FA6E3B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1780162440; bh=NeXlS2Ir8d1jmxgQa/mSAeKxhRzYevgazF56ts0MqqI=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YrdLBhDQ7gHVbQ3e9uNMRHZly2eqKke/9+aAQIWvL5f8W6C3yy6rD2lvOqXXKYzNI s3h9s7pnUqhOkVe9vZ8L4n95NLizncePJoMeeQ0THWigQL0YSN1ISugTbtySWLH3Nf eYuaaGkkLWCaIihxDXKelBgu+fVn7kSF8mu1e/K+/OmAzy9I1dCBbVIkBzMLYWLsSk jcFppvtVQMLxNtz5MLgYLStDvr49gyzcgkzRyILgZtuvrdXWs6QQ59Dyi1sNWzx0bn 094Xli8GnLw/qYjLQ3OKzeu/vGsIHriDTTTgr8czEo3Rx+yQk0tIvkQ+WRBRK/ytE3 gSEISzapJpesQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 965FA6E3B4; Sat, 30 May 2026 17:34:00 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 5AF91F4 for ; Sat, 30 May 2026 17:33:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4D7126E3B4 for ; Sat, 30 May 2026 17:33:59 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id C3ElqiHVy-oU for ; Sat, 30 May 2026 17:33:58 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 6B89C61737 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6B89C61737 Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6B89C61737 for ; Sat, 30 May 2026 17:33:57 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id ABE9441521; Sat, 30 May 2026 17:33:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE42D1F00893; Sat, 30 May 2026 17:33:56 +0000 (UTC) From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, intel-wired-lan@lists.osuosl.org, Bart Van Assche , Aleksandr Loktionov , Przemek Kitszel , Arpana Arland , Jacob Keller , Jakub Kicinski , Sasha Levin Date: Sat, 30 May 2026 18:07:25 +0200 Message-ID: <20260530160326.170163059@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162437; bh=NeXlS2Ir8d1jmxgQa/mSAeKxhRzYevgazF56ts0MqqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P9howm58sgMtslxTSjqfOb3HMKqUDik2WZD2vepZxozzVdkhHT2Kv+YIt17CGHY+K U6lZ6jTQl1VTlQVBmeU7D8SUaG2vStOocKYXunKg1ryb9rBKbMHN2O0jMmYwRoUHZ5 j7GZbb8x9CNuldVBkStxcjed/ThXUWbOEQpFW4ko= X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=P9howm58 Subject: [Intel-wired-lan] [PATCH 6.1 921/969] 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: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit 0ded1f36ba4021cba50513e80be6b6e173710168 ] 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: intel-wired-lan@lists.osuosl.org Fixes: 242b5e068b25 ("ice: Fix DCB rebuild after reset") Signed-off-by: Bart Van Assche Reviewed-by: Aleksandr Loktionov Reviewed-by: Przemek Kitszel Tested-by: Arpana Arland Signed-off-by: Jacob Keller Link: https://patch.msgid.link/20260506-jk-iwl-net-2026-05-04-v2-6-a5ea4dc837a9@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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/ethernet/intel/ice/ice_dcb_lib.c index 9aa0437aa598e..cc097207cf97f 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c @@ -530,14 +530,14 @@ void ice_dcb_rebuild(struct ice_pf *pf) struct ice_dcbx_cfg *err_cfg; int ret; + mutex_lock(&pf->tc_mutex); + ret = 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; } - mutex_lock(&pf->tc_mutex); - if (!pf->hw.port_info->qos_cfg.is_sw_lldp) ice_cfg_etsrec_defaults(pf->hw.port_info); -- 2.53.0