{"id":"CVE-2026-139391","state":"PUBLISHED","title":"ocfs2: retain all security xattrs during inode creation","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: retain all security xattrs during inode creation\n\nWhen creating a new inode, ocfs2_init_security_get() stores the security\nxattr returned by the LSM framework in ocfs2_security_xattr_info so that\nit can be written later within the same transaction.  But\nocfs2_initxattrs() only ever looks at the first element of the xattr\narray, and it keeps the name as a bare pointer into memory owned by the\nsecurity layer instead of copying it.  The value, by contrast, is already\nduplicated with kmemdup().\n\nWith stacked LSMs, security_inode_init_security() provides one xattr per\nLSM, so all labels but the first are silently dropped and never written to\ndisk, leaving newly created files without the security xattrs the other\nLSMs rely on.\n\nThe borrowed name is not an outright bug with the LSMs in tree today:\nsecurity_inode_init_security() frees only ->value once the callback\nreturns, and documents ->name as the attribute name suffix, so the pointer\nstays valid for as long as ocfs2 uses it.  It is fragile though, as an LSM\nthat allocates the name together with the value would turn it into a\nuse-after-free, so the rework below copies the names as well.\n\nFix this by storing copies of all the security xattrs: allocate an array\nin ocfs2_initxattrs(), copy the names and values, account for all of them\nin the credit calculations, and write each one in\nocfs2_init_security_set().\n\nWhile at it, switch the allocations from GFP_KERNEL to GFP_NOFS.  The\ncallback runs in the inode creation path with the parent directory locked,\nand the security layer allocates the very same xattr array with GFP_NOFS,\nso direct reclaim must not be allowed to recurse into the filesystem from\nhere.","publishedAt":"2026-11-30T13:34:19.377Z","updatedAt":"2026-11-30T13:34:19.377Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c41324385aa7c9ac0fc1fa9c2521aacedea24788","status":"affected","lessThan":"ce055a1378e5b4e8fcaf1c8dc4df82c326bf9306","versionType":"git"},{"version":"291fe3d6f5dbafa6dd87a510c1351e8ce8a8a52e","status":"affected","lessThan":"1b9930ebec9dc92b3cce3231dcb9ed8ebd5da7dd","versionType":"git"},{"version":"8bdf47f9dbeac6b247c8f14fbaebfe020d9a2ffa","status":"affected","lessThan":"ae8ee59668124a4a544996727067cc5ae20af6dd","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"3a6df319db221e1bc4eb0ce22218c904512b1f60","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"5c815fd8de4a7e935b287ebf980121876f229b76","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"5bc277c89570e096c574188dcfdd538e3c139bd1","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"314f6183f13fda459261a4723a453df67e15008b","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"d637475617d8468c2740a3436428681bcc8d3572","versionType":"git"},{"version":"0c80524f34e66fed0bc837758c5a80b1527847a4","status":"affected","versionType":"git"},{"version":"5.10.181","status":"affected","lessThan":"5.10.275","versionType":"semver"},{"version":"5.15.114","status":"affected","lessThan":"5.15.226","versionType":"semver"},{"version":"6.1.31","status":"affected","lessThan":"6.1.193","versionType":"semver"},{"version":"6.3.5","status":"affected","lessThan":"6.4","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/namei.c","fs/ocfs2/xattr.c","fs/ocfs2/xattr.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.4","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/namei.c","fs/ocfs2/xattr.c","fs/ocfs2/xattr.h"]}],"references":["https://git.kernel.org/stable/c/ce055a1378e5b4e8fcaf1c8dc4df82c326bf9306","https://git.kernel.org/stable/c/1b9930ebec9dc92b3cce3231dcb9ed8ebd5da7dd","https://git.kernel.org/stable/c/ae8ee59668124a4a544996727067cc5ae20af6dd","https://git.kernel.org/stable/c/3a6df319db221e1bc4eb0ce22218c904512b1f60","https://git.kernel.org/stable/c/5c815fd8de4a7e935b287ebf980121876f229b76","https://git.kernel.org/stable/c/5bc277c89570e096c574188dcfdd538e3c139bd1","https://git.kernel.org/stable/c/314f6183f13fda459261a4723a453df67e15008b","https://git.kernel.org/stable/c/d637475617d8468c2740a3436428681bcc8d3572"],"weaknesses":[],"ingestedAt":"2026-11-30T13:48:04.491Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139391.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139391","state":"PUBLISHED","datePublished":"2026-11-30T13:34:19.377Z","dateUpdated":"2026-11-30T13:34:19.377Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.931Z"},"containers":{"cna":{"title":"ocfs2: retain all security xattrs during inode creation","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: retain all security xattrs during inode creation\n\nWhen creating a new inode, ocfs2_init_security_get() stores the security\nxattr returned by the LSM framework in ocfs2_security_xattr_info so that\nit can be written later within the same transaction.  But\nocfs2_initxattrs() only ever looks at the first element of the xattr\narray, and it keeps the name as a bare pointer into memory owned by the\nsecurity layer instead of copying it.  The value, by contrast, is already\nduplicated with kmemdup().\n\nWith stacked LSMs, security_inode_init_security() provides one xattr per\nLSM, so all labels but the first are silently dropped and never written to\ndisk, leaving newly created files without the security xattrs the other\nLSMs rely on.\n\nThe borrowed name is not an outright bug with the LSMs in tree today:\nsecurity_inode_init_security() frees only ->value once the callback\nreturns, and documents ->name as the attribute name suffix, so the pointer\nstays valid for as long as ocfs2 uses it.  It is fragile though, as an LSM\nthat allocates the name together with the value would turn it into a\nuse-after-free, so the rework below copies the names as well.\n\nFix this by storing copies of all the security xattrs: allocate an array\nin ocfs2_initxattrs(), copy the names and values, account for all of them\nin the credit calculations, and write each one in\nocfs2_init_security_set().\n\nWhile at it, switch the allocations from GFP_KERNEL to GFP_NOFS.  The\ncallback runs in the inode creation path with the parent directory locked,\nand the security layer allocates the very same xattr array with GFP_NOFS,\nso direct reclaim must not be allowed to recurse into the filesystem from\nhere."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c41324385aa7c9ac0fc1fa9c2521aacedea24788","status":"affected","lessThan":"ce055a1378e5b4e8fcaf1c8dc4df82c326bf9306","versionType":"git"},{"version":"291fe3d6f5dbafa6dd87a510c1351e8ce8a8a52e","status":"affected","lessThan":"1b9930ebec9dc92b3cce3231dcb9ed8ebd5da7dd","versionType":"git"},{"version":"8bdf47f9dbeac6b247c8f14fbaebfe020d9a2ffa","status":"affected","lessThan":"ae8ee59668124a4a544996727067cc5ae20af6dd","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"3a6df319db221e1bc4eb0ce22218c904512b1f60","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"5c815fd8de4a7e935b287ebf980121876f229b76","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"5bc277c89570e096c574188dcfdd538e3c139bd1","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"314f6183f13fda459261a4723a453df67e15008b","versionType":"git"},{"version":"de3004c874e740304cc4f4a83d6200acb511bbda","status":"affected","lessThan":"d637475617d8468c2740a3436428681bcc8d3572","versionType":"git"},{"version":"0c80524f34e66fed0bc837758c5a80b1527847a4","status":"affected","versionType":"git"},{"version":"5.10.181","status":"affected","lessThan":"5.10.275","versionType":"semver"},{"version":"5.15.114","status":"affected","lessThan":"5.15.226","versionType":"semver"},{"version":"6.1.31","status":"affected","lessThan":"6.1.193","versionType":"semver"},{"version":"6.3.5","status":"affected","lessThan":"6.4","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/namei.c","fs/ocfs2/xattr.c","fs/ocfs2/xattr.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.4","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/namei.c","fs/ocfs2/xattr.c","fs/ocfs2/xattr.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/ce055a1378e5b4e8fcaf1c8dc4df82c326bf9306"},{"url":"https://git.kernel.org/stable/c/1b9930ebec9dc92b3cce3231dcb9ed8ebd5da7dd"},{"url":"https://git.kernel.org/stable/c/ae8ee59668124a4a544996727067cc5ae20af6dd"},{"url":"https://git.kernel.org/stable/c/3a6df319db221e1bc4eb0ce22218c904512b1f60"},{"url":"https://git.kernel.org/stable/c/5c815fd8de4a7e935b287ebf980121876f229b76"},{"url":"https://git.kernel.org/stable/c/5bc277c89570e096c574188dcfdd538e3c139bd1"},{"url":"https://git.kernel.org/stable/c/314f6183f13fda459261a4723a453df67e15008b"},{"url":"https://git.kernel.org/stable/c/d637475617d8468c2740a3436428681bcc8d3572"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:34:19.377Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.10.181","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15.114","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.1.31","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.4","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.4","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.4","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.4","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.4","versionEndExcluding":"7.4-rc1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.3.5"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}