Lucene search

K
cvelistLinuxCVELIST:CVE-2023-52909
HistoryAug 21, 2024 - 6:10 a.m.

CVE-2023-52909 nfsd: fix handling of cached open files in nfsd4_open codepath

2024-08-2106:10:50
Linux
www.cve.org
2
linux kernel
nfsd
vulnerability resolved
race condition
nf_file pointer
nfs4_get_vfs_file
tracepoints

EPSS

0

Percentile

5.1%

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

nfsd: fix handling of cached open files in nfsd4_open codepath

Commit fb70bf124b05 (“NFSD: Instantiate a struct file when creating a
regular NFSv4 file”) added the ability to cache an open fd over a
compound. There are a couple of problems with the way this currently
works:

It’s racy, as a newly-created nfsd_file can end up with its PENDING bit
cleared while the nf is hashed, and the nf_file pointer is still zeroed
out. Other tasks can find it in this state and they expect to see a
valid nf_file, and can oops if nf_file is NULL.

Also, there is no guarantee that we’ll end up creating a new nfsd_file
if one is already in the hash. If an extant entry is in the hash with a
valid nf_file, nfs4_get_vfs_file will clobber its nf_file pointer with
the value of op_file and the old nf_file will leak.

Fix both issues by making a new nfsd_file_acquirei_opened variant that
takes an optional file pointer. If one is present when this is called,
we’ll take a new reference to it instead of trying to open the file. If
the nfsd_file already has a valid nf_file, we’ll just ignore the
optional file and pass the nfsd_file back as-is.

Also rework the tracepoints a bit to allow for an “opened” variant and
don’t try to avoid counting acquisitions in the case where we already
have a cached open file.

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "fs/nfsd/filecache.c",
      "fs/nfsd/filecache.h",
      "fs/nfsd/nfs4state.c",
      "fs/nfsd/trace.h"
    ],
    "versions": [
      {
        "version": "c20097329d2c",
        "lessThan": "45c08a752982",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "106331a12b0f",
        "lessThan": "0b778361998d",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "fb70bf124b05",
        "lessThan": "973acfdfe90c",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "fb70bf124b05",
        "lessThan": "0b3a551fa58b",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "fs/nfsd/filecache.c",
      "fs/nfsd/filecache.h",
      "fs/nfsd/nfs4state.c",
      "fs/nfsd/trace.h"
    ],
    "versions": [
      {
        "version": "5.19",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "5.19",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.7",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.2",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

EPSS

0

Percentile

5.1%