Subject: CVE-2024-47737: nfsd: call cache_put if xdr_reserve_space returns NULL

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

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

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

nfsd: call cache_put if xdr_reserve_space returns NULL

If not enough buffer space available, but idmap_lookup has triggered
lookup_fn which calls cache_get and returns successfully. Then we
missed to call cache_put here which pairs with cache_get.

Reviwed-by: Jeff Layton <[email-masked]>

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

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

	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 5.10.227 with commit 9f03f0016ff7
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 5.15.168 with commit 9803ab882d56
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 6.1.113 with commit 818216173129
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 6.6.54 with commit a1afbbb5276f
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 6.10.13 with commit e32ee6a61041
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 6.11.2 with commit 8d0765f86135
	Issue introduced in 3.16 with commit ddd1ea563672 and fixed in 6.12-rc1 with commit d078cbf5c38d

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-47737
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:
	fs/nfsd/nfs4idmap.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/9f03f0016ff797932551881c7e06ae50e9c39134
	https://git.kernel.org/stable/c/9803ab882d565a8fb2dde5999d98866d1c499dfd
	https://git.kernel.org/stable/c/81821617312988096f5deccf0f7da6f888e98056
	https://git.kernel.org/stable/c/a1afbbb5276f943ad7173d0b4c626b8c75a260da
	https://git.kernel.org/stable/c/e32ee6a61041925d1a05c14d10352dcfce9ef029
	https://git.kernel.org/stable/c/8d0765f86135e27f0bb5c950c136495719b4c834
	https://git.kernel.org/stable/c/d078cbf5c38de83bc31f83c47dcd2184c04a50c7