{"id":"CVE-2026-99966","aliases":["CVE-2026-99966"],"related":[],"kind":"vulnerability","state":"published","title":"ocfs2: reserve metadata for a new xattr block and its value tree","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: reserve metadata for a new xattr block and its value tree\n\nPatch series \"ocfs2: fix metadata reservation for xattr value trees\".\n\nocfs2_calc_xattr_set_need() reserves too little metadata for a new xattr\nvalue's extent tree on three paths.  The reservation cannot be topped up\nonce the transaction has started, so ocfs2_add_clusters_in_btree() gives\nup with RESTART_META when the value root fills and nothing is left. \nocfs2_xattr_extend_allocation() turns that into -ENOSPC, after\nocfs2_xa_cleanup_value_truncate() has dropped the entry and leaked the\nclusters already handed out; before commit 0cdc7dde00ec (\"ocfs2: fix\nmissing metadata reservation for large xattrs\") it was a BUG_ON() instead.\nIt takes a fragmented cluster allocator to get there, since the first\nextent always fits in the root.\n\nPatch 1 fixes the create side of meta_guess: commit 3ed2be719eb9 (\"ocfs2:\nallow for more than one data extent when creating xattr\") replaced the\nblock reserved for the new xattr block with the two the value tree needs\ninstead of adding them together.\n\nPatch 2 fixes the arm that moves an xattr back into the inode, which\ncharges credits for a value tree but no metadata for one.\n\nPatch 3 drops a second copy of the same reservation on the path that falls\nthrough to meta_guess.  That one is cleanup rather than a fix and is not\nfor stable, and it must not be backported without patch 1: the duplicate\nit removes is what currently covers the shortfall patch 1 fixes.\n\n\nThis patch (of 3):\n\nThe create side of meta_guess in ocfs2_calc_xattr_set_need() reserves\nmetadata for the new value's extent tree and nothing for the xattr block\nthat will hold it:\n\n        } else {\n                credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;\n                if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {\n                        struct ocfs2_extent_list *el = &def_xv.xv.xr_list;\n                        meta_add += ocfs2_extend_meta_needed(el);\n                        ...\n\nCommit 3ed2be719eb9 (\"ocfs2: allow for more than one data extent when\ncreating xattr\") meant to add that tree on top of the meta_add += 1 the\nbranch already had, but it moved the 1 into the else arm instead, so the\nexternal-value case lost it.  The 1 is not optional: it is what\nocfs2_create_xattr_block() takes from meta_ac through\nocfs2_claim_metadata(), and it is spent before the value tree exists.\n\nocfs2_extend_meta_needed() on the empty def_xv list returns 2, so the\nbranch reserves 2 where 3 are needed.  The xattr block consumes one, and\nwhen the cluster allocator is fragmented enough that the value needs more\nthan one extent, ocfs2_add_clusters_in_btree() comes back around with a\nfull value root and ocfs2_alloc_context_bits_left() of 1 against a\nthreshold of 2.  It answers RESTART_META, which\nocfs2_xattr_extend_allocation() turns into a BUG_ON().  Commit\n0cdc7dde00ec (\"ocfs2: fix missing metadata reservation for large xattrs\")\ndowngraded that to -ENOSPC, at the cost of leaking the clusters already\nhanded out: ocfs2_xa_cleanup_value_truncate() takes its !orig_clusters\narm, drops the entry and leaves the clusters for fsck.ocfs2 to reclaim.\n\nReserve for the block and the tree separately.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: reserve metadata for a new xattr block and its value tree\n\nPatch series \"ocfs2: fix metadata reservation for xattr value trees\".\n\nocfs2_calc_xattr_set_need() reserves too little metadata for a new xattr\nvalue's extent tree on three paths.  The reservation cannot be topped up\nonce the transaction has started, so ocfs2_add_clusters_in_btree() gives\nup with RESTART_META when the value root fills and nothing is left. \nocfs2_xattr_extend_allocation() turns that into -ENOSPC, after\nocfs2_xa_cleanup_value_truncate() has dropped the entry and leaked the\nclusters already handed out; before commit 0cdc7dde00ec (\"ocfs2: fix\nmissing metadata reservation for large xattrs\") it was a BUG_ON() instead.\nIt takes a fragmented cluster allocator to get there, since the first\nextent always fits in the root.\n\nPatch 1 fixes the create side of meta_guess: commit 3ed2be719eb9 (\"ocfs2:\nallow for more than one data extent when creating xattr\") replaced the\nblock reserved for the new xattr block with the two the value tree needs\ninstead of adding them together.\n\nPatch 2 fixes the arm that moves an xattr back into the inode, which\ncharges credits for a value tree but no metadata for one.\n\nPatch 3 drops a second copy of the same reservation on the path that falls\nthrough to meta_guess.  That one is cleanup rather than a fix and is not\nfor stable, and it must not be backported without patch 1: the duplicate\nit removes is what currently covers the shortfall patch 1 fixes.\n\n\nThis patch (of 3):\n\nThe create side of meta_guess in ocfs2_calc_xattr_set_need() reserves\nmetadata for the new value's extent tree and nothing for the xattr block\nthat will hold it:\n\n        } else {\n                credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;\n                if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {\n                        struct ocfs2_extent_list *el = &def_xv.xv.xr_list;\n                        meta_add += ocfs2_extend_meta_needed(el);\n                        ...\n\nCommit 3ed2be719eb9 (\"ocfs2: allow for more than one data extent when\ncreating xattr\") meant to add that tree on top of the meta_add += 1 the\nbranch already had, but it moved the 1 into the else arm instead, so the\nexternal-value case lost it.  The 1 is not optional: it is what\nocfs2_create_xattr_block() takes from meta_ac through\nocfs2_claim_metadata(), and it is spent before the value tree exists.\n\nocfs2_extend_meta_needed() on the empty def_xv list returns 2, so the\nbranch reserves 2 where 3 are needed.  The xattr block consumes one, and\nwhen the cluster allocator is fragmented enough that the value needs more\nthan one extent, ocfs2_add_clusters_in_btree() comes back around with a\nfull value root and ocfs2_alloc_context_bits_left() of 1 against a\nthreshold of 2.  It answers RESTART_META, which\nocfs2_xattr_extend_allocation() turns into a BUG_ON().  Commit\n0cdc7dde00ec (\"ocfs2: fix missing metadata reservation for large xattrs\")\ndowngraded that to -ENOSPC, at the cost of leaking the clusters already\nhanded out: ocfs2_xa_cleanup_value_truncate() takes its !orig_clusters\narm, drops the entry and leaves the clusters for fsck.ocfs2 to reclaim.\n\nReserve for the block and the tree separately.","source":"cvelist"}],"published":"2026-11-30T13:18:42.981Z","modified":"2026-11-30T14:20:35.860Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"90ddf54d556b274d336356144947e1cd8f61db00","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"bbb1e1d86906734ed94af449ec811775991dab63","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"328e653052589b62a86f495e70d68934ebd0e188","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"c877e33cc65777f13d78a0132d425bfa5b498d5a","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"cdba7a2e76c4a5742b831601d7cfa511ac418426","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"16452d2c14525e6da15960afb8feea69a9060f19","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"a12657044a3181fa5801ac1f7a55d053594cd0a7","status":"affected"},{"type":"git","introduced":"3ed2be719eb9770139da791342b190b20a7a9270","fixed":"8ad5fa0c11246d260d7b12c9672e604b1f431b2e","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"3.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"3.15","status":"unaffected"},{"type":"semver","introduced":"5.10.275","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.226","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.193","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.117","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.63","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.4","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/90ddf54d556b274d336356144947e1cd8f61db00","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/bbb1e1d86906734ed94af449ec811775991dab63","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/328e653052589b62a86f495e70d68934ebd0e188","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c877e33cc65777f13d78a0132d425bfa5b498d5a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cdba7a2e76c4a5742b831601d7cfa511ac418426","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/16452d2c14525e6da15960afb8feea69a9060f19","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a12657044a3181fa5801ac1f7a55d053594cd0a7","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/8ad5fa0c11246d260d7b12c9672e604b1f431b2e","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-99966","url":"https://www.cve.org/CVERecord?id=CVE-2026-99966","licence":"CVE Terms of Use","modified":"2026-11-30T13:18:42.981Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-99966","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99966","licence":"Public domain","modified":"2026-11-30T14:20:35.860Z"}],"updatedAt":"2026-11-30T14:33:34.275Z","epss":{"score":0.00325,"percentile":0.27621,"date":"2026-12-01T12:00:22.000Z"}}