{"id":"CVE-2023-54253","state":"PUBLISHED","title":"btrfs: set page extent mapped after read_folio in relocate_one_page","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: set page extent mapped after read_folio in relocate_one_page\n\nOne of the CI runs triggered the following panic\n\n  assertion failed: PagePrivate(page) && page->private, in fs/btrfs/subpage.c:229\n  ------------[ cut here ]------------\n  kernel BUG at fs/btrfs/subpage.c:229!\n  Internal error: Oops - BUG: 00000000f2000800 [#1] SMP\n  CPU: 0 PID: 923660 Comm: btrfs Not tainted 6.5.0-rc3+ #1\n  pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)\n  pc : btrfs_subpage_assert+0xbc/0xf0\n  lr : btrfs_subpage_assert+0xbc/0xf0\n  sp : ffff800093213720\n  x29: ffff800093213720 x28: ffff8000932138b4 x27: 000000000c280000\n  x26: 00000001b5d00000 x25: 000000000c281000 x24: 000000000c281fff\n  x23: 0000000000001000 x22: 0000000000000000 x21: ffffff42b95bf880\n  x20: ffff42b9528e0000 x19: 0000000000001000 x18: ffffffffffffffff\n  x17: 667274622f736620 x16: 6e69202c65746176 x15: 0000000000000028\n  x14: 0000000000000003 x13: 00000000002672d7 x12: 0000000000000000\n  x11: ffffcd3f0ccd9204 x10: ffffcd3f0554ae50 x9 : ffffcd3f0379528c\n  x8 : ffff800093213428 x7 : 0000000000000000 x6 : ffffcd3f091771e8\n  x5 : ffff42b97f333948 x4 : 0000000000000000 x3 : 0000000000000000\n  x2 : 0000000000000000 x1 : ffff42b9556cde80 x0 : 000000000000004f\n  Call trace:\n   btrfs_subpage_assert+0xbc/0xf0\n   btrfs_subpage_set_dirty+0x38/0xa0\n   btrfs_page_set_dirty+0x58/0x88\n   relocate_one_page+0x204/0x5f0\n   relocate_file_extent_cluster+0x11c/0x180\n   relocate_data_extent+0xd0/0xf8\n   relocate_block_group+0x3d0/0x4e8\n   btrfs_relocate_block_group+0x2d8/0x490\n   btrfs_relocate_chunk+0x54/0x1a8\n   btrfs_balance+0x7f4/0x1150\n   btrfs_ioctl+0x10f0/0x20b8\n   __arm64_sys_ioctl+0x120/0x11d8\n   invoke_syscall.constprop.0+0x80/0xd8\n   do_el0_svc+0x6c/0x158\n   el0_svc+0x50/0x1b0\n   el0t_64_sync_handler+0x120/0x130\n   el0t_64_sync+0x194/0x198\n  Code: 91098021 b0007fa0 91346000 97e9c6d2 (d4210000)\n\nThis is the same problem outlined in 17b17fcd6d44 (\"btrfs:\nset_page_extent_mapped after read_folio in btrfs_cont_expand\") , and the\nfix is the same.  I originally looked for the same pattern elsewhere in\nour code, but mistakenly skipped over this code because I saw the page\ncache readahead before we set_page_extent_mapped, not realizing that\nthis was only in the !page case, that we can still end up with a\n!uptodate page and then do the btrfs_read_folio further down.\n\nThe fix here is the same as the above mentioned patch, move the\nset_page_extent_mapped call to after the btrfs_read_folio() block to\nmake sure that we have the subpage blocksize stuff setup properly before\nusing the page.","publishedAt":"2025-12-30T12:15:49.460Z","updatedAt":"2026-05-11T19:58:25.144Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"08daa38ca212d87f77beae839bc9be71079c7abf","versionType":"git"},{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"9d1e020ed9649cf140fcfafd052cfdcce9e9d67d","versionType":"git"},{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"e7f1326cc24e22b38afc3acd328480a1183f9e79","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"6.1.54","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.5.4","status":"unaffected","lessThanOrEqual":"6.5.*","versionType":"semver"},{"version":"6.6","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]}],"references":["https://git.kernel.org/stable/c/08daa38ca212d87f77beae839bc9be71079c7abf","https://git.kernel.org/stable/c/9d1e020ed9649cf140fcfafd052cfdcce9e9d67d","https://git.kernel.org/stable/c/e7f1326cc24e22b38afc3acd328480a1183f9e79"],"weaknesses":[],"ingestedAt":"2026-10-29T20:06:42.242Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2023/54xxx/CVE-2023-54253.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2023-54253","state":"PUBLISHED","datePublished":"2025-12-30T12:15:49.460Z","dateUpdated":"2026-05-11T19:58:25.144Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-12-30T12:06:44.515Z"},"containers":{"cna":{"title":"btrfs: set page extent mapped after read_folio in relocate_one_page","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: set page extent mapped after read_folio in relocate_one_page\n\nOne of the CI runs triggered the following panic\n\n  assertion failed: PagePrivate(page) && page->private, in fs/btrfs/subpage.c:229\n  ------------[ cut here ]------------\n  kernel BUG at fs/btrfs/subpage.c:229!\n  Internal error: Oops - BUG: 00000000f2000800 [#1] SMP\n  CPU: 0 PID: 923660 Comm: btrfs Not tainted 6.5.0-rc3+ #1\n  pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)\n  pc : btrfs_subpage_assert+0xbc/0xf0\n  lr : btrfs_subpage_assert+0xbc/0xf0\n  sp : ffff800093213720\n  x29: ffff800093213720 x28: ffff8000932138b4 x27: 000000000c280000\n  x26: 00000001b5d00000 x25: 000000000c281000 x24: 000000000c281fff\n  x23: 0000000000001000 x22: 0000000000000000 x21: ffffff42b95bf880\n  x20: ffff42b9528e0000 x19: 0000000000001000 x18: ffffffffffffffff\n  x17: 667274622f736620 x16: 6e69202c65746176 x15: 0000000000000028\n  x14: 0000000000000003 x13: 00000000002672d7 x12: 0000000000000000\n  x11: ffffcd3f0ccd9204 x10: ffffcd3f0554ae50 x9 : ffffcd3f0379528c\n  x8 : ffff800093213428 x7 : 0000000000000000 x6 : ffffcd3f091771e8\n  x5 : ffff42b97f333948 x4 : 0000000000000000 x3 : 0000000000000000\n  x2 : 0000000000000000 x1 : ffff42b9556cde80 x0 : 000000000000004f\n  Call trace:\n   btrfs_subpage_assert+0xbc/0xf0\n   btrfs_subpage_set_dirty+0x38/0xa0\n   btrfs_page_set_dirty+0x58/0x88\n   relocate_one_page+0x204/0x5f0\n   relocate_file_extent_cluster+0x11c/0x180\n   relocate_data_extent+0xd0/0xf8\n   relocate_block_group+0x3d0/0x4e8\n   btrfs_relocate_block_group+0x2d8/0x490\n   btrfs_relocate_chunk+0x54/0x1a8\n   btrfs_balance+0x7f4/0x1150\n   btrfs_ioctl+0x10f0/0x20b8\n   __arm64_sys_ioctl+0x120/0x11d8\n   invoke_syscall.constprop.0+0x80/0xd8\n   do_el0_svc+0x6c/0x158\n   el0_svc+0x50/0x1b0\n   el0t_64_sync_handler+0x120/0x130\n   el0t_64_sync+0x194/0x198\n  Code: 91098021 b0007fa0 91346000 97e9c6d2 (d4210000)\n\nThis is the same problem outlined in 17b17fcd6d44 (\"btrfs:\nset_page_extent_mapped after read_folio in btrfs_cont_expand\") , and the\nfix is the same.  I originally looked for the same pattern elsewhere in\nour code, but mistakenly skipped over this code because I saw the page\ncache readahead before we set_page_extent_mapped, not realizing that\nthis was only in the !page case, that we can still end up with a\n!uptodate page and then do the btrfs_read_folio further down.\n\nThe fix here is the same as the above mentioned patch, move the\nset_page_extent_mapped call to after the btrfs_read_folio() block to\nmake sure that we have the subpage blocksize stuff setup properly before\nusing the page."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"08daa38ca212d87f77beae839bc9be71079c7abf","versionType":"git"},{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"9d1e020ed9649cf140fcfafd052cfdcce9e9d67d","versionType":"git"},{"version":"32443de3382be98c0a8b8f6f50d23da2e10c4117","status":"affected","lessThan":"e7f1326cc24e22b38afc3acd328480a1183f9e79","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.12","versionType":"semver"},{"version":"6.1.54","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.5.4","status":"unaffected","lessThanOrEqual":"6.5.*","versionType":"semver"},{"version":"6.6","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/08daa38ca212d87f77beae839bc9be71079c7abf"},{"url":"https://git.kernel.org/stable/c/9d1e020ed9649cf140fcfafd052cfdcce9e9d67d"},{"url":"https://git.kernel.org/stable/c/e7f1326cc24e22b38afc3acd328480a1183f9e79"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T19:58:25.144Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"6.1.54"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"6.5.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.12","versionEndExcluding":"6.6"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}