Subject: CVE-2023-52762: virtio-blk: fix implicit overflow on virtio_max_dma_size

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

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

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

virtio-blk: fix implicit overflow on virtio_max_dma_size

The following codes have an implicit conversion from size_t to u32:
(u32)max_size = (size_t)virtio_max_dma_size(vdev);

This may lead overflow, Ex (size_t)4G -> (u32)0. Once
virtio_max_dma_size() has a larger size than U32_MAX, use U32_MAX
instead.

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

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

	Fixed in 5.15.140 with commit 72775cad7f57
	Fixed in 6.1.64 with commit 472bd4787406
	Fixed in 6.5.13 with commit 017278f14114
	Fixed in 6.6.3 with commit d667fe301dcb
	Fixed in 6.7 with commit fafb51a67fb8

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-52762
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/block/virtio_blk.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/72775cad7f572bb2501f9ea609e1d20e68f0b38b
	https://git.kernel.org/stable/c/472bd4787406bef2e8b41ee4c74d960a06a49a48
	https://git.kernel.org/stable/c/017278f141141367f7d14b203e930b45b6ffffb9
	https://git.kernel.org/stable/c/d667fe301dcbcb12d1d6494fc4b8abee2cb75d90
	https://git.kernel.org/stable/c/fafb51a67fb883eb2dde352539df939a251851be