Subject: CVE-2022-48911: netfilter: nf_queue: fix possible use-after-free

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

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

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

netfilter: nf_queue: fix possible use-after-free

Eric Dumazet says:
  The sock_hold() side seems suspect, because there is no guarantee
  that sk_refcnt is not already 0.

On failure, we cannot queue the packet and need to indicate an
error.  The packet will be dropped by the caller.

v2: split skb prefetch hunk into separate change

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

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

	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 4.9.305 with commit 21b27b2baa27
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 4.14.270 with commit ef97921ccdc2
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 4.19.233 with commit 34dc4a6a7f26
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 5.4.183 with commit 43c25da41e30
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 5.10.104 with commit 4d05239203fa
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 5.15.27 with commit dd648bd1b33a
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 5.16.13 with commit dcc3cb920bf7
	Issue introduced in 2.6.29 with commit 271b72c7fa82 and fixed in 5.17 with commit c3873070247d

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-48911
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/netfilter/nf_queue.h
	net/netfilter/nf_queue.c
	net/netfilter/nfnetlink_queue.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/21b27b2baa27423286e9b8d3f0b194d587083d95
	https://git.kernel.org/stable/c/ef97921ccdc243170fcef857ba2a17cf697aece5
	https://git.kernel.org/stable/c/34dc4a6a7f261736ef7183868a5bddad31c7f9e3
	https://git.kernel.org/stable/c/43c25da41e3091b31a906651a43e80a2719aa1ff
	https://git.kernel.org/stable/c/4d05239203fa38ea8a6f31e228460da4cb17a71a
	https://git.kernel.org/stable/c/dd648bd1b33a828f62befa696b206c688da0ec43
	https://git.kernel.org/stable/c/dcc3cb920bf7ba66ac5e9272293a9ba5f80917ee
	https://git.kernel.org/stable/c/c3873070247d9e3c7a6b0cf9bf9b45e8018427b1