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 941C435DA67; Thu, 28 May 2026 20:24:07 +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=1779999848; cv=none; b=flb3WpfIJf8vdCn97bakAjluzAE4+ZltvPyHR3Mzf8I2PzMe1vuFXXiaZKysPZhH412S72az8NgSLkgTqT1IVnZKqY/EFtJVaJn/BqA/DR8FsXT9PZ9FsFKQ7l+hag6GVVI6nkQ8AKNWP5XKRnirJGNXaYnkVKniBM0qLkjl+zY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999848; c=relaxed/simple; bh=QnNRnCMCz3PI0t5rqe5x3R/kMwZb22oQpPMPH4uV8Cs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJ7mmcwe1105bdHQtDCnSnccnshDwdMaqLweFnHV1TWL6aaB2Cg8rP9Bh4mQSF9WAIsgE5ws5E0qgyGO3htcdMbmicCh3vN5WTSC1zYkhIFjfaCIkxSSbhELgOo1lZr7YtVQKKATea1uoJ6uaMie7fEAktTNmDnpH2FeHS8PoP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1pad1rmO; 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="1pad1rmO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C025C1F00A3D; Thu, 28 May 2026 20:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999847; bh=f+buzPHP/yFGPxo5y7pttiRm4CAr4PHQWonzd0GLfQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1pad1rmO/t2vM1y6R/tLhp10GORt2E5xCAU7SGfqEbAkzEEHpzXDZBUb3RiVoyyeq O08X/7d2vdHnUWxoKiGEsX6fKBCQAYZPqzdgOk/McHSRkTuciehm9iv2hqlLMUA4Wn 7rk0CPN9G6276RMJi9SYjnWfZudsO6SVkgIXm5Jc= 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.18 212/377] ice: fix locking in ice_dcb_rebuild() Date: Thu, 28 May 2026 21:47:30 +0200 Message-ID: <20260528194644.539441066@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 9fc8681cc58ea..270f5a00ece3a 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; + 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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 1CE93CD6E4A for ; Thu, 28 May 2026 20:24:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CFA6A811C1; Thu, 28 May 2026 20:24:12 +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 fNc1-ab73C5y; Thu, 28 May 2026 20:24:10 +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 smtp1.osuosl.org 973C9811C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1779999850; bh=f+buzPHP/yFGPxo5y7pttiRm4CAr4PHQWonzd0GLfQU=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=7aGYwXhEChciHCNolejLLUKh6dCRQ7Muf3r/1gLuH1/PJKf07almwLRLmsaz/3Cmv vcsHpXdFqefHGZoaAtiFDWvvwowcgCd5T/DxGayKVfLKQUTFdzQBt3gFRPDYAy94e3 NWRdQig9Sz19TQqYkVYnSWe5Ac2taWgqOnI1MdAJrUIP85ByLU9exlUnmd1KJgVPNG MY+2hdt2xfaxy+5dDS//hZd691+FA8bNZzUKEc12R2oItTe4niXBZa5OBltCMeMKfS ICOkiihvbL6gNJbHHBGcjhUdUE4xCrezs826fVeklwb3FbV7GI0wIKo1NGnvtqD8IZ UEP1C8U2Fn2sA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 973C9811C0; Thu, 28 May 2026 20:24:10 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id 5BA59D3 for ; Thu, 28 May 2026 20:24:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 4B41240180 for ; Thu, 28 May 2026 20:24:09 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3k0JPW5B078t for ; Thu, 28 May 2026 20:24:08 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 44EA9400BA DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 44EA9400BA Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by smtp2.osuosl.org (Postfix) with ESMTPS id 44EA9400BA for ; Thu, 28 May 2026 20:24:07 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5D3AC443F0; Thu, 28 May 2026 20:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C025C1F00A3D; Thu, 28 May 2026 20:24:06 +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: Thu, 28 May 2026 21:47:30 +0200 Message-ID: <20260528194644.539441066@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@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=1779999847; bh=f+buzPHP/yFGPxo5y7pttiRm4CAr4PHQWonzd0GLfQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1pad1rmO/t2vM1y6R/tLhp10GORt2E5xCAU7SGfqEbAkzEEHpzXDZBUb3RiVoyyeq O08X/7d2vdHnUWxoKiGEsX6fKBCQAYZPqzdgOk/McHSRkTuciehm9iv2hqlLMUA4Wn 7rk0CPN9G6276RMJi9SYjnWfZudsO6SVkgIXm5Jc= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org X-Mailman-Original-Authentication-Results: smtp2.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=1pad1rmO Subject: [Intel-wired-lan] [PATCH 6.18 212/377] 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.18-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 9fc8681cc58ea..270f5a00ece3a 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; + 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