Subject: CVE-2023-52764: media: gspca: cpia1: shift-out-of-bounds in set_flicker

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

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

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

media: gspca: cpia1: shift-out-of-bounds in set_flicker

Syzkaller reported the following issue:
UBSAN: shift-out-of-bounds in drivers/media/usb/gspca/cpia1.c:1031:27
shift exponent 245 is too large for 32-bit type 'int'

When the value of the variable "sd->params.exposure.gain" exceeds the
number of bits in an integer, a shift-out-of-bounds error is reported. It
is triggered because the variable "currentexp" cannot be left-shifted by
more than the number of bits in an integer. In order to avoid invalid
range during left-shift, the conditional expression is added.

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

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

	Fixed in 4.14.331 with commit 69bba62600bd
	Fixed in 4.19.300 with commit 2eee8edfff90
	Fixed in 5.4.262 with commit 8f83c85ee882
	Fixed in 5.10.202 with commit c6b6b8692218
	Fixed in 5.15.140 with commit 09cd8b561aa9
	Fixed in 6.1.64 with commit a647f27a7426
	Fixed in 6.5.13 with commit 93bddd6529f1
	Fixed in 6.6.3 with commit e2d7149b913d
	Fixed in 6.7 with commit 099be1822d1f

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-52764
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/media/usb/gspca/cpia1.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/69bba62600bd91d6b7c1e8ca181faf8ac64f7060
	https://git.kernel.org/stable/c/2eee8edfff90e22980a6b22079d238c3c9d323bb
	https://git.kernel.org/stable/c/8f83c85ee88225319c52680792320c02158c2a9b
	https://git.kernel.org/stable/c/c6b6b8692218da73b33b310d7c1df90f115bdd9a
	https://git.kernel.org/stable/c/09cd8b561aa9796903710a1046957f2b112c8f26
	https://git.kernel.org/stable/c/a647f27a7426d2fe1b40da7c8fa2b81354a51177
	https://git.kernel.org/stable/c/93bddd6529f187f510eec759f37d0569243c9809
	https://git.kernel.org/stable/c/e2d7149b913d14352c82624e723ce1c211ca06d3
	https://git.kernel.org/stable/c/099be1822d1f095433f4b08af9cc9d6308ec1953