Subject: CVE-2023-52660: media: rkisp1: Fix IRQ handling due to shared interrupts

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

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

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

media: rkisp1: Fix IRQ handling due to shared interrupts

The driver requests the interrupts as IRQF_SHARED, so the interrupt
handlers can be called at any time. If such a call happens while the ISP
is powered down, the SoC will hang as the driver tries to access the
ISP registers.

This can be reproduced even without the platform sharing the IRQ line:
Enable CONFIG_DEBUG_SHIRQ and unload the driver, and the board will
hang.

Fix this by adding a new field, 'irqs_enabled', which is used to bail
out from the interrupt handler when the ISP is not operational.

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

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

	Fixed in 6.1.83 with commit abd34206f396
	Fixed in 6.6.23 with commit b39b4d207d4f
	Fixed in 6.7.11 with commit edcf92bc66d8
	Fixed in 6.8 with commit ffb635bb398f

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-52660
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/platform/rockchip/rkisp1/rkisp1-capture.c
	drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
	drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c
	drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
	drivers/media/platform/rockchip/rkisp1/rkisp1-isp.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/abd34206f396d3ae50cddbd5aa840b8cd7f68c63
	https://git.kernel.org/stable/c/b39b4d207d4f236a74e20d291f6356f2231fd9ee
	https://git.kernel.org/stable/c/edcf92bc66d8361c51dff953a55210e5cfd95587
	https://git.kernel.org/stable/c/ffb635bb398fc07cb38f8a7b4a82cbe5f412f08e