{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2023-53804",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2023-53804"
  ],
  "published": "2025-12-09T00:01:55Z",
  "summary": "nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nnilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()\n\nDuring unmount process of nilfs2, nothing holds nilfs_root structure after\nnilfs2 detaches its writer in nilfs_detach_log_writer().  However, since\nnilfs_evict_inode() uses nilfs_root for some cleanup operations, it may\ncause use-after-free read if inodes are left in \"garbage_list\" and\nreleased by nilfs_dispose_list() at the end of nilfs_detach_log_writer().\n\nFix this issue by modifying nilfs_evict_inode() to only clear inode\nwithout additional metadata changes that use nilfs_root if the file system\nis degraded to read-only or the writer is detached.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Raspberry Pi OS:12",
        "name": "linux"
      },
      "versions": [
        "1:6.1.21-1+rpt1"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.1.0-rpi1-rpi-v6",
            "binary_version": "1:6.1.21-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi1-rpi-v7",
            "binary_version": "1:6.1.21-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi1-rpi-v7l",
            "binary_version": "1:6.1.21-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi1-rpi-v8",
            "binary_version": "1:6.1.21-1+rpt1"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.1.21-1+rpt1": {
            "linux_commit": "0afb5e98488aed7017b9bf321b575d0177feb7ed",
            "upstream_version": "6.1.21",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.1.30"
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2023-53804"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/f31e18131ee2ce80a4da5c808221d25b1ae9ad6d"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/2a782ea8ebd712a458466e3103e2881b4f886cb5"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/116d53f09ff52e6f98e3fe1f85d8898d6ba26c68"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/6b4205ea97901f822004e6c8d59484ccfda03faa"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b8427b8522d9ede53015ba45a9978ba68d1162f5"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/acc2a40e428f12780004e1e9fce4722d88f909fd"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/fb8e8d58f116d069e5939e1f786ac84e7fa4533e"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9b5a04ac3ad9898c4745cba46ea26de74ba56a8e"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T11:24:39Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - The flaw is reached only through a locally mounted nilfs2 volume \u2014 attacker-supplied on-disk metadata plus ordinary local file syscalls and the unmount path; nothing in fs/nilfs2 parses data from a remote peer.\nAC:L - The attacker fully authors the on-disk image, so the `__nilfs_error()`\u2192`SB_RDONLY` degeneration and the resulting `-EROFS` bail in `nilfs_segctor_do_construct()` are deterministic, and the free-then-use ordering inside `nilfs_detach_log_writer()` is a fixed code sequence rather than a race; syzbot reproduced it reliably.\nPR:L - An unprivileged local desktop/kiosk user is enough: udisks2/polkit lets an active local session mount and eject removable media without a password, and the writes that strand inodes on `ns_dirty_files` are ordinary unprivileged VFS operations \u2014 matching the PR:L assigned to the same-family nilfs2 crafted-image CVEs.\nUI:N - On an auto-mounting host the attacker performs every step themselves \u2014 supply the image, dirty the inodes, trigger the eject/unmount \u2014 so no action by a separate victim is required.\nS:U - The freed `nilfs_root` and `ifile` objects and any resulting corruption stay entirely within the kernel's own security authority; no hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - After `kfree(root)`, `nilfs_evict_inode()` reads `ii->i_root->ifile` from a reclaimable general-purpose slab object and passes it to `nilfs_ifile_get_inode_block()`/`nilfs_palloc_*`, so a groomed replacement object yields an attacker-chosen inode pointer and arbitrary kernel memory read; `root->ifile` itself is also already freed and its address_space is read out of freed memory.\nI:H - `atomic64_dec(&ii->i_root->inodes_count)` writes directly into the freed slab object at a fixed offset, and `nilfs_ifile_delete_inode()` performs `raw_inode->i_flags = 0` plus `mark_buffer_dirty()` through the attacker-reclaimable `->ifile` pointer, giving write primitives suitable for control-flow hijacking as well as corrupting ifile/allocator metadata written back to disk.\nA:H - This is a use-after-free that syzbot detected via KASAN; dereferencing the freed `nilfs_root` and the already-`iput()`ed ifile inode during unmount readily oopses or panics the kernel, and the corruption drives further filesystem failure."
    }
  }
}
