{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2023-54050",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2023-54050"
  ],
  "published": "2025-12-24T12:27:01Z",
  "summary": "ubifs: Fix memleak when insert_old_idx() failed",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nubifs: Fix memleak when insert_old_idx() failed\n\nFollowing process will cause a memleak for copied up znode:\n\ndirty_cow_znode\n  zn = copy_znode(c, znode);\n  err = insert_old_idx(c, zbr->lnum, zbr->offs);\n  if (unlikely(err))\n     return ERR_PTR(err);   // No one refers to zn.\n\nFetch a reproducer in [Link].\n\nFunction copy_znode() is split into 2 parts: resource allocation\nand znode replacement, insert_old_idx() is split in similar way,\nso resource cleanup could be done in error handling path without\ncorrupting metadata(mem & disk).\nIt's okay that old index inserting is put behind of add_idx_dirt(),\nold index is used in layout_leb_in_gaps(), so the two processes do\nnot depend on each other.",
  "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.28"
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2023-54050"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/cc29c7216d7f057eb0613b97dc38c7e1962a88d2"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/6f2eee5457bc48b0426dedfd78cdbdea241a6edb"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/66e9f2fb3e753f820bec2a98e8c6387029988320"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/3ae75f82c33fa1b4ca2006b55c84f4ef4a428d4d"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/ef9aac603659e9ffe7d69ae16e3f0fc0991a965b"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/79079cebbeed624b9d01cfcf1e3254ae1a1f6e14"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/a6da0ab9847779e05a7416c7a98148b549de69ef"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b5fda08ef213352ac2df7447611eb4d383cce929"
    }
  ],
  "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 vulnerable path is reached only through local filesystem syscalls (write/create/unlink/rename/truncate) on a mounted UBIFS volume via ubifs_jnl_* \u2192 ubifs_tnc_add/remove \u2192 lookup_level0_dirty \u2192 dirty_cow_znode. No network protocol handler parses remote data into this code.\nAC:L - Both preconditions are attacker-driven: the COW branch is entered by forcing a commit with fsync/sync while doing metadata work, and the GFP_NOFS allocation failure is produced by deliberately induced memory pressure, which is readily achievable by an unprivileged process on the memory-constrained embedded systems where UBIFS is deployed and which simultaneously activates the shrinker path that turns the corruption into a UAF.\nPR:L - Only an unprivileged local user with write access to any directory on the UBIFS mount is needed; there is no capability, namespace, or admin check anywhere between the syscall entry and dirty_cow_znode.\nUI:N - The attacker triggers everything with their own file operations on an already-mounted filesystem; no victim action, no mount by another user, and no special file is required.\nS:U - The corruption is confined to the kernel's own TNC structures and the mounted filesystem; there is no crossing into another security authority such as a hypervisor or IOMMU domain.\nC:H - The dangling zbranch[].znode left after shrink_tnc() frees a child through the orphaned parent yields a use-after-free read of a generic kmalloc slab object, letting the attacker read reclaimed kernel memory through TNC descent and, with a sprayed replacement znode, escalate to arbitrary kernel reads.\nI:H - The same use-after-free gives write access to the freed/reallocated znode (flag setting, key_copy, parent re-pointing), a classic control-flow-hijack primitive, and the truncated commit list plus mis-set cparent additionally corrupt the on-disk index \u2014 the commit message itself cites \"corrupting metadata(mem & disk)\".\nA:H - Beyond the znode memory leak, the orphaned root case NULL-derefs in ubifs_tnc_levelorder_next() and runs off the end of ubifs_destroy_tnc_subtree() (oops at shrink or unmount), and the dirty_zn_cnt/parent assertions in get_znodes_to_commit() force the filesystem read-only or BUG() depending on assert_action."
    }
  }
}
