From nobody Thu Mar 26 23:53:42 2026 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 4655E37D10B for ; Mon, 23 Feb 2026 22:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771884149; cv=none; b=IE18F1+2/t0cjeOrinIrnQVtUTpwUGj9qw6VM/KJg/BQB2/3BqPzYN9bWDpsJlFRFWdk4JeFVDULGl1jlogRa7L5zD876IG9w2UpKXvIAq65MkAUliaS01h1mjMRGMwjqkAGyh2yBo52/Oxb42UzYKeD/GJyUCdKF/g0iGwkdnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771884149; c=relaxed/simple; bh=mvhzky+B8G0on98GxAjYmPagcuW0NzkjpzsDMSODh0k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CXzACSaH9BAHS6jBin+mjueY/7PCtkLcWgMwvmWPsabM399ACEO7/ZwBsZQVy8QGUfsxhTfCL35HMi6DwYubE0SUL9WX8jWAcH7iCbjTuy7lRGVKIQe8U26VCw9uQbtlBSdVlghuueelUXgiOQswL3VFITX9UiL2JXT3QEWM3g4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pijj5riv; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pijj5riv" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1771884146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=24QQdcjZhM80ilIGLqtANVCR5SSQQFNTsmuDLQafI8g=; b=pijj5riv5kFPKmLqQUVK+pOjN7QnhmxBUd48g2Viq9ScGi4sbhQgwJ8iiTL3PeF+rPamzC 1g01hKQcYtenZ9jaO5OVgqWhneyq+DJJ+lH3ioV2EKEIlPdx+4lHJodiv3i30p9AEWlMmf M1w1Y+bnvMWF1sNzftb60qSGXr2FLfA= From: Bart Van Assche To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, Marco Elver , Christoph Hellwig , Steven Rostedt , Nick Desaulniers , Nathan Chancellor , Kees Cook , Jann Horn , Bart Van Assche , Tony Nguyen , Przemek Kitszel , intel-wired-lan@lists.osuosl.org Subject: [PATCH 19/62] ice: Fix a locking bug in an error path Date: Mon, 23 Feb 2026 14:00:19 -0800 Message-ID: <20260223220102.2158611-20-bart.vanassche@linux.dev> In-Reply-To: <20260223220102.2158611-1-bart.vanassche@linux.dev> References: <20260223220102.2158611-1-bart.vanassche@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Bart Van Assche Move the mutex_lock() call up to prevent that DCB settings change after the ice_query_port_ets() call. This patch fixes a bug in an error path. Without this patch pf->tc_mutex may be unlocked in an error path without having been locked. This bug has been detected by the clang thread-safety analyzer. Cc: Tony Nguyen Cc: Przemek Kitszel Cc: intel-wired-lan@lists.osuosl.org Fixes: 242b5e068b25 ("ice: Fix DCB rebuild after reset") Signed-off-by: Bart Van Assche --- 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/eth= ernet/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);