{"id":"CVE-2024-49958","summary":"ocfs2: reserve space for inline xattr before attaching reflink tree","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: reserve space for inline xattr before attaching reflink tree\n\nOne of our customers reported a crash and a corrupted ocfs2 filesystem. \nThe crash was due to the detection of corruption.  Upon troubleshooting,\nthe fsck -fn output showed the below corruption\n\n[EXTENT_LIST_FREE] Extent list in owner 33080590 claims 230 as the next free chain record,\nbut fsck believes the largest valid value is 227.  Clamp the next record value? n\n\nThe stat output from the debugfs.ocfs2 showed the following corruption\nwhere the \"Next Free Rec:\" had overshot the \"Count:\" in the root metadata\nblock.\n\n        Inode: 33080590   Mode: 0640   Generation: 2619713622 (0x9c25a856)\n        FS Generation: 904309833 (0x35e6ac49)\n        CRC32: 00000000   ECC: 0000\n        Type: Regular   Attr: 0x0   Flags: Valid\n        Dynamic Features: (0x16) HasXattr InlineXattr Refcounted\n        Extended Attributes Block: 0  Extended Attributes Inline Size: 256\n        User: 0 (root)   Group: 0 (root)   Size: 281320357888\n        Links: 1   Clusters: 141738\n        ctime: 0x66911b56 0x316edcb8 -- Fri Jul 12 06:02:30.829349048 2024\n        atime: 0x66911d6b 0x7f7a28d -- Fri Jul 12 06:11:23.133669517 2024\n        mtime: 0x66911b56 0x12ed75d7 -- Fri Jul 12 06:02:30.317552087 2024\n        dtime: 0x0 -- Wed Dec 31 17:00:00 1969\n        Refcount Block: 2777346\n        Last Extblk: 2886943   Orphan Slot: 0\n        Sub Alloc Slot: 0   Sub Alloc Bit: 14\n        Tree Depth: 1   Count: 227   Next Free Rec: 230\n        ## Offset        Clusters       Block#\n        0  0             2310           2776351\n        1  2310          2139           2777375\n        2  4449          1221           2778399\n        3  5670          731            2779423\n        4  6401          566            2780447\n        .......          ....           .......\n        .......          ....           .......\n\nThe issue was in the reflink workfow while reserving space for inline\nxattr.  The problematic function is ocfs2_reflink_xattr_inline().  By the\ntime this function is called the reflink tree is already recreated at the\ndestination inode from the source inode.  At this point, this function\nreserves space for inline xattrs at the destination inode without even\nchecking if there is space at the root metadata block.  It simply reduces\nthe l_count from 243 to 227 thereby making space of 256 bytes for inline\nxattr whereas the inode already has extents beyond this index (in this\ncase up to 230), thereby causing corruption.\n\nThe fix for this is to reserve space for inline metadata at the destination\ninode before the reflink tree gets recreated. The customer has verified the\nfix.","modified":"2026-03-20T12:38:12.211360Z","published":"2024-10-21T18:02:11.702Z","related":["MGASA-2024-0344","MGASA-2024-0345","SUSE-SU-2024:3983-1","SUSE-SU-2024:3984-1","SUSE-SU-2024:3985-1","SUSE-SU-2024:3986-1","SUSE-SU-2024:4100-1","SUSE-SU-2024:4318-1","SUSE-SU-2024:4364-1","SUSE-SU-2024:4387-1","SUSE-SU-2025:0034-1","SUSE-SU-2025:20163-1","SUSE-SU-2025:20164-1","SUSE-SU-2025:20246-1","SUSE-SU-2025:20247-1","USN-7276-1","USN-7277-1","openSUSE-SU-2024:14500-1","openSUSE-SU-2025:14705-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49958.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/020f5c53c17f66c0a8f2d37dad27ace301b8d8a1"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5c2072f02c0d75802ec28ec703b7d43a0dd008b5"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5c9807c523b4fca81d3e8e864dabc8c806402121"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5ca60b86f57a4d9648f68418a725b3a7de2816b0"},{"type":"WEB","url":"https://git.kernel.org/stable/c/637c00e06564a945e9d0edb3d78d362d64935f9f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/74364cb578dcc0b6c9109519d19cbe5a56afac9a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/96ce4c3537114d1698be635f5e36c62dc49df7a4"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9f9a8f3ac65b4147f1a7b6c05fad5192c0e3c3d9"},{"type":"WEB","url":"https://git.kernel.org/stable/c/aac31d654a0a31cb0d2fa36ae694f4e164a52707"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49958.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49958"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"ef962df057aaafd714f5c22ba3de1be459571fdf"},{"fixed":"5c9807c523b4fca81d3e8e864dabc8c806402121"},{"fixed":"74364cb578dcc0b6c9109519d19cbe5a56afac9a"},{"fixed":"aac31d654a0a31cb0d2fa36ae694f4e164a52707"},{"fixed":"020f5c53c17f66c0a8f2d37dad27ace301b8d8a1"},{"fixed":"5c2072f02c0d75802ec28ec703b7d43a0dd008b5"},{"fixed":"637c00e06564a945e9d0edb3d78d362d64935f9f"},{"fixed":"9f9a8f3ac65b4147f1a7b6c05fad5192c0e3c3d9"},{"fixed":"96ce4c3537114d1698be635f5e36c62dc49df7a4"},{"fixed":"5ca60b86f57a4d9648f68418a725b3a7de2816b0"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"0"},{"last_affected":"3a32958d2ac96070c53d04bd8e013c97b260b5e6"},{"last_affected":"93f26306db89c9dc37885b76a1082e6d54d23b16"},{"last_affected":"26a849f49fb3347d126a0ed6611173f903374ef4"},{"last_affected":"1e7e4c9ae2a78a6791a2ca91a6a400f94855f01e"},{"last_affected":"1926bf8ae44d80c9f50103f11fc4f17e2e2bf684"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-49958.json"}}],"schema_version":"1.7.5"}