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 DD16318E02A; Fri, 7 Aug 2026 15:18:03 +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=1786115885; cv=none; b=jx23HEDk3dEbEP+YJm7iOgNE94RTMwAuIWR1iGVRShQ9h+8F7PZ5IKRAs8LT0//kvA3zksBTWnHos8WCgDj0icaDzyanvfFJ75crxyF9Kbhzg1zIwxzmnGEuWspVOc+AoSXx6M3Dq8ah5DMgDy5+DdZumPvatBB8wZolD3BPPMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115885; c=relaxed/simple; bh=3LWStC1DRApK8bOEJfsrbxsl92whIaEON2/qkP59LQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a05801Rnfc8c7cMjtc2s+I7ltfkW0DfDk1hpErbz64LdwoigRK+VSgY//mLUgFf+gX9nrwXEifQhT2+bMJO1+z0yKTPt471d+fhpAhkfYA25AOjADWESMYftsDdeg6QsSqM9xPUPnrD+m5N5659rogXsl4mfIYGw6TIpZd55VTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ghxBprGV; 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="ghxBprGV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45FBC1F000E9; Fri, 7 Aug 2026 15:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786115883; bh=o9HiBTBLHUl/q4y8rNP9di3SrNnZ9Hb/+hjMMDfDYJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ghxBprGV+SxvUPgb1JY9ZNxvfkA2TlczXZb4Yj/jLiSqvW+g10anS4GywNfY5MqoU W0ZNPTFUqv+3vNlY/5O61NafiHDKgZVCizC95ZMrh/j/5+SE0vfNraoBq63H9pjo9t PZEj1kFYK/hUvnW6vKms0Q8ntgo2o3cvjcfult9E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko AI , HyeongJun An , Chris Leech , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.6 037/261] scsi: libiscsi: Fix stale-data leak into the SCSI sense buffer Date: Fri, 7 Aug 2026 16:36:34 +0200 Message-ID: <20260807143416.181709779@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143415.358597922@linuxfoundation.org> References: <20260807143415.358597922@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An [ Upstream commit 98b87885de4b7f605533a2860685f5689fce8e82 ] iscsi_scsi_cmd_rsp() copies the sense data of a SCSI Response from the target-supplied data segment. The segment carries a 2-byte sense length followed by the sense bytes, so it must hold 2 + senselen bytes, but the bounds check only requires datalen >= senselen: senselen = get_unaligned_be16(data); if (datalen < senselen) goto invalid_datalen; memcpy(sc->sense_buffer, data + 2, min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); A target that returns a SCSI Response whose datalen equals senselen (with senselen <= SCSI_SENSE_BUFFERSIZE) makes the memcpy() from data + 2 read up to two bytes past the received data. Those bytes are stale conn->data contents and end up in the command's sense buffer, which is returned to userspace. Account for the 2-byte sense length prefix in the check. Fixes: 7996a778ff8c ("[SCSI] iscsi: add libiscsi") Suggested-by: Sashiko AI Assisted-by: Claude:claude-opus-4-8 Signed-off-by: HyeongJun An Acked-by: Chris Leech Link: https://patch.msgid.link/20260714104934.1404423-1-sammiee5311@gmail.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libiscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 916c076484608..213aea93120d9 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -918,7 +918,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, } senselen = get_unaligned_be16(data); - if (datalen < senselen) + if (datalen < senselen + 2) goto invalid_datalen; memcpy(sc->sense_buffer, data + 2, -- 2.53.0