Skip to contentSkip to conversation

CVE-2024-57927: nfs: Fix oops in nfs_netfs_init_request() when copying to cache

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jan 19, 2025

lore
Share & tools
lore
#0 lore raw

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

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

nfs: Fix oops in nfs_netfs_init_request() when copying to cache

When netfslib wants to copy some data that has just been read on behalf of nfs, it creates a new write request and calls nfs_netfs_init_request() to initialise it, but with a NULL file pointer. This causes nfs_file_open_context() to oops - however, we don't actually need the nfs context as we're only going to write to the cache.

Fix this by just returning if we aren't given a file pointer and emit a warning if the request was for something other than copy-to-cache.

Further, fix nfs_netfs_free_request() so that it doesn't try to free the context if the pointer is NULL.

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

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

	Issue introduced in 6.12 with commit ee4cdf7ba857a894ad1650d6ab77669cbbfa329e and fixed in 6.12.10 with commit 13a07cc81e2d116cece727a83746c74b87a9d417
	Issue introduced in 6.12 with commit ee4cdf7ba857a894ad1650d6ab77669cbbfa329e and fixed in 6.13-rc7 with commit 86ad1a58f6a9453f49e06ef957a40a8dac00a13f

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-57927

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/nfs/fscache.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/13a07cc81e2d116cece727a83746c74b87a9d417
	https://git.kernel.org/stable/c/86ad1a58f6a9453f49e06ef957a40a8dac00a13f