From mboxrd@z Thu Jan 1 00:00:00 1970 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 D593037998C; Mon, 23 Feb 2026 22:02:41 +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=1771884163; cv=none; b=shrM6AOTL9TxZqHFZY/u6CMQ8Cl99/tOwuFe1ayq1a0DZeVIuQXiiJ5ipqEo5MBJ8J+eZkQhFWOnrAEh0UP8mz9NyW4cRtrPvzHNyUQx4rc22o2luTJAvOQb3Shdad82us7Q/Q8+DtL9GQQ0uIU6LnFAUdDwqGZ5Z9wgMGdmnbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771884163; c=relaxed/simple; bh=zBb6mY6LVBQZG53/Ne4qfrtb7F1pvMFODtdvM36L/Bw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UIbDqJ3vn4CLO+ulDFAFnXtEnrsoS+8REZ93J7fiVcdV+UTSO6f5yTofdSCKr35fKuvnQeiT+IB5SxMDKb1scoliVgj1iezPvCB3TWjjtDoESSybsLJjum5+KB0vLv5J0pJHQJj7HuFmtvaR7Ok1EI77IFisWcPTS7xG7xbkCWg= 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=RgHLochO; 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="RgHLochO" 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=1771884160; 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=U47yNyBfWkqKR3Rj7UJ6cJggyqzDOHOKMwq4b4Z42/4=; b=RgHLochOGv835K53uzth1qNblnbD78R2/BtdgcA4A0ldbJb22XLXL5OF+0LPSBqAShinKH eOUbNMcsUzG42SbcLBnirIVdHQ+3mDzrM2GSB4fRtknvK04MA2kEf5KBgpO3swnWgAIjgZ m/UMcn3L23bU3PWYakcRzKNsYeMVuQc= 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 , Leo Yang , Paolo Abeni , Jeremy Kerr , Matt Johnston , netdev@vger.kernel.org Subject: [PATCH 22/62] mctp i3c: Fix locking in error paths Date: Mon, 23 Feb 2026 14:00:22 -0800 Message-ID: <20260223220102.2158611-23-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: 8bit X-Migadu-Flow: FLOW_OUT From: Bart Van Assche Only unlock mi->lock if it has been locked. This bug has been detected by the Clang thread-safety analyzer. Cc: Leo Yang Cc: Paolo Abeni Cc: Jeremy Kerr Cc: Matt Johnston Cc: netdev@vger.kernel.org Fixes: 2d2d4f60ed26 ("mctp i3c: fix MCTP I3C driver multi-thread issue") Signed-off-by: Bart Van Assche --- drivers/net/mctp/mctp-i3c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c index 6d2bbae7477b..d4a29912c7e1 100644 --- a/drivers/net/mctp/mctp-i3c.c +++ b/drivers/net/mctp/mctp-i3c.c @@ -112,7 +112,7 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi) if (!skb) { stats->rx_dropped++; rc = -ENOMEM; - goto err; + goto free_skb; } skb->protocol = htons(ETH_P_MCTP); @@ -170,8 +170,11 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi) mutex_unlock(&mi->lock); return 0; + err: mutex_unlock(&mi->lock); + +free_skb: kfree_skb(skb); return rc; }