Subject: CVE-2024-46832: MIPS: cevt-r4k: Don't call get_c0_compare_int if timer irq is installed

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

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

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

MIPS: cevt-r4k: Don't call get_c0_compare_int if timer irq is installed

This avoids warning:

[    0.118053] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:283

Caused by get_c0_compare_int on secondary CPU.

We also skipped saving IRQ number to struct clock_event_device *cd as
it's never used by clockevent core, as per comments it's only meant
for "non CPU local devices".

The Linux kernel CVE team has assigned CVE-2024-46832 to this issue.

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

	Fixed in 5.10.226 with commit d3ff0f98a52f
	Fixed in 5.15.167 with commit e6cd871627ab
	Fixed in 6.1.110 with commit b1d2051373bf
	Fixed in 6.6.51 with commit 32ee0520159f
	Fixed in 6.10.10 with commit 189d3ed3b25b
	Fixed in 6.11 with commit 50f2b98dc83d

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-2024-46832
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:
	arch/mips/kernel/cevt-r4k.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/d3ff0f98a52f0aafe35aa314d1c442f4318be3db
	https://git.kernel.org/stable/c/e6cd871627abbb459d0ff6521d6bb9cf9d9f7522
	https://git.kernel.org/stable/c/b1d2051373bfc65371ce4ac8911ed984d0178c98
	https://git.kernel.org/stable/c/32ee0520159f1e8c2d6597c19690df452c528f30
	https://git.kernel.org/stable/c/189d3ed3b25beee26ffe2abed278208bece13f52
	https://git.kernel.org/stable/c/50f2b98dc83de7809a5c5bf0ccf9af2e75c37c13