Subject: CVE-2022-48804: vt_ioctl: fix array_index_nospec in vt_setactivate

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

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

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

vt_ioctl: fix array_index_nospec in vt_setactivate

array_index_nospec ensures that an out-of-bounds value is set to zero
on the transient path. Decreasing the value by one afterwards causes
a transient integer underflow. vsa.console should be decreased first
and then sanitized with array_index_nospec.

Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh
Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU
Amsterdam.

The Linux kernel CVE team has assigned CVE-2022-48804 to this issue.

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

	Fixed in 4.9.302 with commit 830c5aa302ec
	Fixed in 4.14.267 with commit 2a45a6bd1e6d
	Fixed in 4.19.230 with commit 170325aba460
	Fixed in 5.4.180 with commit ae3d57411562
	Fixed in 5.10.101 with commit 778302ca0949
	Fixed in 5.15.24 with commit ffe54289b02e
	Fixed in 5.16.10 with commit 6550bdf52846
	Fixed in 5.17 with commit 61cc70d9e8ef

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-2022-48804
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/tty/vt/vt_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/830c5aa302ec16b4ee641aec769462c37f802c90
	https://git.kernel.org/stable/c/2a45a6bd1e6d651770aafff57ab3e1d3bb0b42e0
	https://git.kernel.org/stable/c/170325aba4608bde3e7d21c9c19b7bc266ac0885
	https://git.kernel.org/stable/c/ae3d57411562260ee3f4fd5e875f410002341104
	https://git.kernel.org/stable/c/778302ca09498b448620edd372dc908bebf80bdf
	https://git.kernel.org/stable/c/ffe54289b02e9c732d6f04c8ebbe3b2d90d32118
	https://git.kernel.org/stable/c/6550bdf52846f85a2a3726a5aa0c7c4399f2fc02
	https://git.kernel.org/stable/c/61cc70d9e8ef5b042d4ed87994d20100ec8896d9