Subject: CVE-2024-36974: net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP

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

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

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

net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP

If one TCA_TAPRIO_ATTR_PRIOMAP attribute has been provided,
taprio_parse_mqprio_opt() must validate it, or userspace
can inject arbitrary data to the kernel, the second time
taprio_change() is called.

First call (with valid attributes) sets dev->num_tc
to a non zero value.

Second call (with arbitrary mqprio attributes)
returns early from taprio_parse_mqprio_opt()
and bad things can happen.

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

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

	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 5.4.279 with commit c6041e712446
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 5.10.221 with commit 6db4af09987c
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 5.15.162 with commit d3dde4c217f0
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 6.1.95 with commit 0bf6cc96612b
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 6.6.35 with commit 724050ae4b76
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 6.9.6 with commit c37a27a35ead
	Issue introduced in 5.2 with commit a3d43c0d56f1 and fixed in 6.10 with commit f921a58ae208

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-36974
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:
	net/sched/sch_taprio.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/c6041e7124464ce7e896ee3f912897ce88a0c4ec
	https://git.kernel.org/stable/c/6db4af09987cc5d5f0136bd46148b0e0460dae5b
	https://git.kernel.org/stable/c/d3dde4c217f0c31ab0621912e682b57e677dd923
	https://git.kernel.org/stable/c/0bf6cc96612bd396048f57d63f1ad454a846e39c
	https://git.kernel.org/stable/c/724050ae4b76e4fae05a923cb54101d792cf4404
	https://git.kernel.org/stable/c/c37a27a35eadb59286c9092c49c241270c802ae2
	https://git.kernel.org/stable/c/f921a58ae20852d188f70842431ce6519c4fdc36