{"id":"CVE-2025-37858","summary":"fs/jfs: Prevent integer overflow in AG size calculation","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nfs/jfs: Prevent integer overflow in AG size calculation\n\nThe JFS filesystem calculates allocation group (AG) size using 1 \u003c\u003c\nl2agsize in dbExtendFS(). When l2agsize exceeds 31 (possible with \u003e2TB\naggregates on 32-bit systems), this 32-bit shift operation causes undefined\nbehavior and improper AG sizing.\n\nOn 32-bit architectures:\n- Left-shifting 1 by 32+ bits results in 0 due to integer overflow\n- This creates invalid AG sizes (0 or garbage values) in\nsbi-\u003ebmap-\u003edb_agsize\n- Subsequent block allocations would reference invalid AG structures\n- Could lead to:\n  - Filesystem corruption during extend operations\n  - Kernel crashes due to invalid memory accesses\n  - Security vulnerabilities via malformed on-disk structures\n\nFix by casting to s64 before shifting:\nbmp-\u003edb_agsize = (s64)1 \u003c\u003c l2agsize;\n\nThis ensures 64-bit arithmetic even on 32-bit architectures. The cast\nmatches the data type of db_agsize (s64) and follows similar patterns in\nJFS block calculation code.\n\nFound by Linux Verification Center (linuxtesting.org) with SVACE.","modified":"2026-05-07T04:18:42.185762Z","published":"2025-05-09T06:42:05.940Z","related":["SUSE-SU-2025:01964-1","SUSE-SU-2025:01965-1","SUSE-SU-2025:02000-1","SUSE-SU-2025:02254-1","SUSE-SU-2025:02307-1","SUSE-SU-2025:02333-1","SUSE-SU-2025:02923-1","SUSE-SU-2025:20408-1","SUSE-SU-2025:20413-1","SUSE-SU-2025:20419-1","SUSE-SU-2025:20421-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/37xxx/CVE-2025-37858.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/211ed8f5e39e61f9e4d18edd64ce8005a67a1b2a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3d8a45f87010a802aa214bf39702ca9d99cbf3ba"},{"type":"WEB","url":"https://git.kernel.org/stable/c/55edbf5dbf60a8195c21e92124c4028939ae16b2"},{"type":"WEB","url":"https://git.kernel.org/stable/c/7ccf3b35274512b60ecb614e0637e76bd6f2d829"},{"type":"WEB","url":"https://git.kernel.org/stable/c/7fcbf789629cdb9fbf4e2172ce31136cfed11e5e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8bb29629a5e4090e1ef7199cb42db04a52802239"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c802a6a4009f585111f903e810b3be9c6d0da329"},{"type":"WEB","url":"https://git.kernel.org/stable/c/dd07a985e2ded47b6c7d69fc93c1fe02977c8454"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ec34cdf4f917cc6abd306cf091f8b8361fedac88"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/05/msg00030.html"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/05/msg00045.html"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/37xxx/CVE-2025-37858.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-37858"},{"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":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2"},{"fixed":"dd07a985e2ded47b6c7d69fc93c1fe02977c8454"},{"fixed":"8bb29629a5e4090e1ef7199cb42db04a52802239"},{"fixed":"3d8a45f87010a802aa214bf39702ca9d99cbf3ba"},{"fixed":"55edbf5dbf60a8195c21e92124c4028939ae16b2"},{"fixed":"7ccf3b35274512b60ecb614e0637e76bd6f2d829"},{"fixed":"c802a6a4009f585111f903e810b3be9c6d0da329"},{"fixed":"211ed8f5e39e61f9e4d18edd64ce8005a67a1b2a"},{"fixed":"ec34cdf4f917cc6abd306cf091f8b8361fedac88"},{"fixed":"7fcbf789629cdb9fbf4e2172ce31136cfed11e5e"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-37858.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.12"},{"fixed":"5.4.293"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.5.0"},{"fixed":"5.10.237"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.181"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.135"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.88"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.24"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.13.12"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.14.0"},{"fixed":"6.14.3"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-37858.json"}}],"schema_version":"1.7.5"}