Subject: CVE-2023-52758: i2c: dev: copy userspace array safely

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

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

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

i2c: dev: copy userspace array safely

i2c-dev.c utilizes memdup_user() to copy a userspace array. This is done
without an overflow check.

Use the new wrapper memdup_array_user() to copy the array more safely.

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

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

	Fixed in 5.15.140 with commit 38ada2f304f6
	Fixed in 6.1.64 with commit aff8be2cad74
	Fixed in 6.5.13 with commit fe4eb2157d8c
	Fixed in 6.6.3 with commit bef76b854493
	Fixed in 6.7 with commit cc9c54232f04

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-52758
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/i2c/i2c-dev.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/38ada2f304f6f2065dd59613ef236a26f4dd73cd
	https://git.kernel.org/stable/c/aff8be2cad74a22525cd89cdff0b72a5c9a4c0c6
	https://git.kernel.org/stable/c/fe4eb2157d8c45b127bd88b1376c38c27b741293
	https://git.kernel.org/stable/c/bef76b8544939518dafa3325bcd438b111136437
	https://git.kernel.org/stable/c/cc9c54232f04aef3a5d7f64a0ece7df00f1aaa3d