Subject: CVE-2023-52458: block: add check that partition length needs to be aligned with block size

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

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

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

block: add check that partition length needs to be aligned with block size

Before calling add partition or resize partition, there is no check
on whether the length is aligned with the logical block size.
If the logical block size of the disk is larger than 512 bytes,
then the partition size maybe not the multiple of the logical block size,
and when the last sector is read, bio_truncate() will adjust the bio size,
resulting in an IO error if the size of the read command is smaller than
the logical block size.If integrity data is supported, this will also
result in a null pointer dereference when calling bio_integrity_free.

The Linux kernel CVE team has assigned CVE-2023-52458 to this issue.

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

	Fixed in 5.10.215 with commit 8f6dfa1f1efe
	Fixed in 5.15.148 with commit 5010c2712096
	Fixed in 6.1.75 with commit ef31cc877947
	Fixed in 6.6.14 with commit cb16cc1abda1
	Fixed in 6.7.2 with commit bcdc288e7bc0
	Fixed in 6.8 with commit 6f64f866aa1a

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-2023-52458
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:
	block/ioctl.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/8f6dfa1f1efe6dcca2d43e575491d8fcbe922f62
	https://git.kernel.org/stable/c/5010c27120962c85d2f421d2cf211791c9603503
	https://git.kernel.org/stable/c/ef31cc87794731ffcb578a195a2c47d744e25fb8
	https://git.kernel.org/stable/c/cb16cc1abda18a9514106d2ac8c8d7abc0be5ed8
	https://git.kernel.org/stable/c/bcdc288e7bc008daf38ef0401b53e4a8bb61bbe5
	https://git.kernel.org/stable/c/6f64f866aa1ae6975c95d805ed51d7e9433a0016