Subject: CVE-2024-46855: netfilter: nft_socket: fix sk refcount leaks

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

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

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

netfilter: nft_socket: fix sk refcount leaks

We must put 'sk' reference before returning.

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

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

	Issue introduced in 5.3 with commit 039b1f4f24ec and fixed in 5.15.168 with commit ddc7c423c4a5
	Issue introduced in 5.3 with commit 039b1f4f24ec and fixed in 6.1.111 with commit 33c2258bf8cb
	Issue introduced in 5.3 with commit 039b1f4f24ec and fixed in 6.6.52 with commit 83e6fb59040e
	Issue introduced in 5.3 with commit 039b1f4f24ec and fixed in 6.10.11 with commit 1f68e097e20d
	Issue introduced in 5.3 with commit 039b1f4f24ec and fixed in 6.11 with commit 8b26ff7af8c3
	Issue introduced in 4.19.76 with commit 6934809432d2
	Issue introduced in 5.2.18 with commit f63432cd1bb2

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-46855
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/netfilter/nft_socket.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/ddc7c423c4a5386bf865474c694b48178efd311a
	https://git.kernel.org/stable/c/33c2258bf8cb17fba9e58b111d4c4f4cf43a4896
	https://git.kernel.org/stable/c/83e6fb59040e8964888afcaa5612cc1243736715
	https://git.kernel.org/stable/c/1f68e097e20d3c695281a9c6433acc37be47fe11
	https://git.kernel.org/stable/c/8b26ff7af8c32cb4148b3e147c52f9e4c695209c