Subject: CVE-2022-48642: netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain()

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

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

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

netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain()

It seems to me that percpu memory for chain stats started leaking since
commit 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to
hardware priority") when nft_chain_offload_priority() returned an error.

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

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

	Issue introduced in 5.3 with commit 3bc158f8d033 and fixed in 5.10.146 with commit b043a525a3f5
	Issue introduced in 5.3 with commit 3bc158f8d033 and fixed in 5.15.71 with commit 08d7524f366a
	Issue introduced in 5.3 with commit 3bc158f8d033 and fixed in 5.19.12 with commit 985b031667c3
	Issue introduced in 5.3 with commit 3bc158f8d033 and fixed in 6.0 with commit 9a4d6dd554b8

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-48642
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/nf_tables_api.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/b043a525a3f5520abb676a7cd8f6328fdf959e88
	https://git.kernel.org/stable/c/08d7524f366a886b99b1630a24a27dd6e0d7f852
	https://git.kernel.org/stable/c/985b031667c3177b9e7fb9787b989628e4271714
	https://git.kernel.org/stable/c/9a4d6dd554b86e65581ef6b6638a39ae079b17ac