Subject: CVE-2024-47682: scsi: sd: Fix off-by-one error in sd_read_block_characteristics()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

scsi: sd: Fix off-by-one error in sd_read_block_characteristics()

Ff the device returns page 0xb1 with length 8 (happens with qemu v2.x, for
example), sd_read_block_characteristics() may attempt an out-of-bounds
memory access when accessing the zoned field at offset 8.

The Linux kernel CVE team has assigned CVE-2024-47682 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.19 with commit 7fb019c46eee and fixed in 6.1.113 with commit 60312ae7392f
	Issue introduced in 5.19 with commit 7fb019c46eee and fixed in 6.6.54 with commit 568c7c4c77ee
	Issue introduced in 5.19 with commit 7fb019c46eee and fixed in 6.10.13 with commit a77605037389
	Issue introduced in 5.19 with commit 7fb019c46eee and fixed in 6.11.2 with commit 413df704f149
	Issue introduced in 5.19 with commit 7fb019c46eee and fixed in 6.12-rc1 with commit f81eaf08385d

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-47682
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/scsi/sd.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/60312ae7392f9c75c6591a52fc359cf7f810d48f
	https://git.kernel.org/stable/c/568c7c4c77eee6df7677bb861b7cee7398a3255d
	https://git.kernel.org/stable/c/a776050373893e4c847a49abeae2ccb581153df0
	https://git.kernel.org/stable/c/413df704f149dec585df07466d2401bbd1f490a0
	https://git.kernel.org/stable/c/f81eaf08385ddd474a2f41595a7757502870c0eb