From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8094228725B; Mon, 9 Feb 2026 14:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648666; cv=none; b=ewwGD/LBidNrv2/scmKH/nHKRlp01zOrDQP6O8XRk9IgNqGKx/rL9YuuhCIzsfsKmYusmzjGtFgJbd3GC5lrQtiGAephji4BkUJsB2+9vsL2y2STkfgiH4opfL6FP+36WFF5jMlcXWm8X0gA2NYLaq629k6i0PnhmnJu6fQEwrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648666; c=relaxed/simple; bh=7p9bGbrPLB1sq0kL6kmmD/Lpi4axe+wjyr2Yildm3p0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JkZazMWoFZssOswhcR/gQzv3v5PVb8g0aRqOfzJ8aHHcUvbpHFKhCF0WCDUGi1oVAgWqQ14EUPY99yAbnOLIRYrABADtfu8mOT6cEScFWSKRLfLH4zEaJa9Ghkux55xwtUB0XrwTlo7zg+I6a3RauZZ7XWgDIQ1/9PwbnejB1SU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Hjt5D3cL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Hjt5D3cL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1EDC116C6; Mon, 9 Feb 2026 14:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648666; bh=7p9bGbrPLB1sq0kL6kmmD/Lpi4axe+wjyr2Yildm3p0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hjt5D3cLO7y7954G92vFIxCvgQmAXECa+OZDWATxEqo+Rx3J9tcDeU4Bm+iYPXllF rvuxyfHDCqLH8c8CIF33RpOJmDKXtvHo48kKylveOOudqqUFu9CoIc3dPztfDmYll0 TpFUtHbC01h8GlD0hcxavmgCpv+J5sK9rd8Scw3Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maurizio Lombardi , Zhaojuan Guo , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 20/41] scsi: target: iscsi: Fix use-after-free in iscsit_dec_session_usage_count() Date: Mon, 9 Feb 2026 15:24:41 +0100 Message-ID: <20260209142257.539928844@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142256.797267956@linuxfoundation.org> References: <20260209142256.797267956@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maurizio Lombardi [ Upstream commit 84dc6037390b8607c5551047d3970336cb51ba9a ] In iscsit_dec_session_usage_count(), the function calls complete() while holding the sess->session_usage_lock. Similar to the connection usage count logic, the waiter signaled by complete() (e.g., in the session release path) may wake up and free the iscsit_session structure immediately. This creates a race condition where the current thread may attempt to execute spin_unlock_bh() on a session structure that has already been deallocated, resulting in a KASAN slab-use-after-free. To resolve this, release the session_usage_lock before calling complete() to ensure all dereferences of the sess pointer are finished before the waiter is allowed to proceed with deallocation. Signed-off-by: Maurizio Lombardi Reported-by: Zhaojuan Guo Reviewed-by: Mike Christie Link: https://patch.msgid.link/20260112165352.138606-3-mlombard@redhat.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/iscsi/iscsi_target_util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 45ba07c6ec270..58b3eb589bc77 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -801,8 +801,11 @@ void iscsit_dec_session_usage_count(struct iscsi_session *sess) spin_lock_bh(&sess->session_usage_lock); sess->session_usage_count--; - if (!sess->session_usage_count && sess->session_waiting_on_uc) + if (!sess->session_usage_count && sess->session_waiting_on_uc) { + spin_unlock_bh(&sess->session_usage_lock); complete(&sess->session_waiting_on_uc_comp); + return; + } spin_unlock_bh(&sess->session_usage_lock); } -- 2.51.0