Subject: CVE-2022-48999: ipv4: Handle attempt to delete multipath route when fib_info contains an nh reference

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

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

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

ipv4: Handle attempt to delete multipath route when fib_info contains an nh reference

Gwangun Jung reported a slab-out-of-bounds access in fib_nh_match:
    fib_nh_match+0xf98/0x1130 linux-6.0-rc7/net/ipv4/fib_semantics.c:961
    fib_table_delete+0x5f3/0xa40 linux-6.0-rc7/net/ipv4/fib_trie.c:1753
    inet_rtm_delroute+0x2b3/0x380 linux-6.0-rc7/net/ipv4/fib_frontend.c:874

Separate nexthop objects are mutually exclusive with the legacy
multipath spec. Fix fib_nh_match to return if the config for the
to be deleted route contains a multipath spec while the fib_info
is using a nexthop object.

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

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

	Issue introduced in 5.3 with commit 493ced1ac47c and fixed in 5.4.226 with commit cc3cd130ecfb
	Issue introduced in 5.3 with commit 493ced1ac47c and fixed in 5.10.158 with commit 0b5394229eba
	Issue introduced in 5.3 with commit 493ced1ac47c and fixed in 5.15.82 with commit 25174d91e4a3
	Issue introduced in 5.3 with commit 493ced1ac47c and fixed in 6.0.12 with commit bb20a2ae241b
	Issue introduced in 5.3 with commit 493ced1ac47c and fixed in 6.1 with commit 61b91eb33a69

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-48999
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/ipv4/fib_semantics.c
	tools/testing/selftests/net/fib_nexthops.sh

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/cc3cd130ecfb8b0ae52e235e487bae3f16a24a32
	https://git.kernel.org/stable/c/0b5394229ebae09afc07aabccb5ffd705ffd250e
	https://git.kernel.org/stable/c/25174d91e4a32a24204060d283bd5fa6d0ddf133
	https://git.kernel.org/stable/c/bb20a2ae241be846bc3c11ea4b3a3c69e41d51f2
	https://git.kernel.org/stable/c/61b91eb33a69c3be11b259c5ea484505cd79f883