Subject: CVE-2024-44986: ipv6: fix possible UAF in ip6_finish_output2()

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

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

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

ipv6: fix possible UAF in ip6_finish_output2()

If skb_expand_head() returns NULL, skb has been freed
and associated dst/idev could also have been freed.

We need to hold rcu_read_lock() to make sure the dst and
associated idev are alive.

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

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

	Issue introduced in 5.14 with commit 5796015fa968 and fixed in 5.15.166 with commit e891b36de161
	Issue introduced in 5.14 with commit 5796015fa968 and fixed in 6.1.107 with commit 3574d28caf9a
	Issue introduced in 5.14 with commit 5796015fa968 and fixed in 6.6.48 with commit 6ab6bf731354
	Issue introduced in 5.14 with commit 5796015fa968 and fixed in 6.10.7 with commit 56efc2531967
	Issue introduced in 5.14 with commit 5796015fa968 and fixed in 6.11 with commit da273b377ae0
	Issue introduced in 5.4.137 with commit ded37d03440d
	Issue introduced in 5.10.55 with commit 2323690eb058
	Issue introduced in 5.13.7 with commit b34c668a867f

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-44986
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/ipv6/ip6_output.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/e891b36de161fcd96f12ff83667473e5067b9037
	https://git.kernel.org/stable/c/3574d28caf9a09756ae87ad1ea096c6f47b6101e
	https://git.kernel.org/stable/c/6ab6bf731354a6fdbaa617d1ec194960db61cf3b
	https://git.kernel.org/stable/c/56efc253196751ece1fc535a5b582be127b0578a
	https://git.kernel.org/stable/c/da273b377ae0d9bd255281ed3c2adb228321687b