Subject: CVE-2024-27418: net: mctp: take ownership of skb in mctp_local_output

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

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

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

net: mctp: take ownership of skb in mctp_local_output

Currently, mctp_local_output only takes ownership of skb on success, and
we may leak an skb if mctp_local_output fails in specific states; the
skb ownership isn't transferred until the actual output routing occurs.

Instead, make mctp_local_output free the skb on all error paths up to
the route action, so it always consumes the passed skb.

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

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

	Issue introduced in 5.15 with commit 833ef3b91de6 and fixed in 6.1.81 with commit a3c8fa54e904
	Issue introduced in 5.15 with commit 833ef3b91de6 and fixed in 6.6.21 with commit cbebc55ceace
	Issue introduced in 5.15 with commit 833ef3b91de6 and fixed in 6.7.9 with commit a639441c880a
	Issue introduced in 5.15 with commit 833ef3b91de6 and fixed in 6.8 with commit 3773d65ae515

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-27418
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:
	include/net/mctp.h
	net/mctp/route.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/a3c8fa54e904b0ddb52a08cc2d8ac239054f61fd
	https://git.kernel.org/stable/c/cbebc55ceacef1fc0651e80e0103cc184552fc68
	https://git.kernel.org/stable/c/a639441c880ac479495e5ab37e3c29f21ae5771b
	https://git.kernel.org/stable/c/3773d65ae5154ed7df404b050fd7387a36ab5ef3