{"id":"CVE-2022-50478","summary":"nilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nnilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()\n\nPatch series \"nilfs2: fix UBSAN shift-out-of-bounds warnings on mount\ntime\".\n\nThe first patch fixes a bug reported by syzbot, and the second one fixes\nthe remaining bug of the same kind.  Although they are triggered by the\nsame super block data anomaly, I divided it into the above two because the\ndetails of the issues and how to fix it are different.\n\nBoth are required to eliminate the shift-out-of-bounds issues at mount\ntime.\n\n\nThis patch (of 2):\n\nIf the block size exponent information written in an on-disk superblock is\ncorrupted, nilfs_sb2_bad_offset helper function can trigger\nshift-out-of-bounds warning followed by a kernel panic (if panic_on_warn\nis set):\n\n shift exponent 38983 is too large for 64-bit type 'unsigned long long'\n Call Trace:\n  \u003cTASK\u003e\n  __dump_stack lib/dump_stack.c:88 [inline]\n  dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106\n  ubsan_epilogue lib/ubsan.c:151 [inline]\n  __ubsan_handle_shift_out_of_bounds+0x33d/0x3b0 lib/ubsan.c:322\n  nilfs_sb2_bad_offset fs/nilfs2/the_nilfs.c:449 [inline]\n  nilfs_load_super_block+0xdf5/0xe00 fs/nilfs2/the_nilfs.c:523\n  init_nilfs+0xb7/0x7d0 fs/nilfs2/the_nilfs.c:577\n  nilfs_fill_super+0xb1/0x5d0 fs/nilfs2/super.c:1047\n  nilfs_mount+0x613/0x9b0 fs/nilfs2/super.c:1317\n  ...\n\nIn addition, since nilfs_sb2_bad_offset() performs multiplication without\nconsidering the upper bound, the computation may overflow if the disk\nlayout parameters are not normal.\n\nThis fixes these issues by inserting preliminary sanity checks for those\nparameters and by converting the comparison from one involving\nmultiplication and left bit-shifting to one using division and right\nbit-shifting.","modified":"2026-04-02T08:28:32.594126Z","published":"2025-10-04T15:16:38.346Z","related":["SUSE-SU-2025:4111-1","SUSE-SU-2025:4139-1","SUSE-SU-2025:4149-1","SUSE-SU-2025:4320-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50478.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/1012ff77284e3bec0ec0a35a820b03ec43dec2cc"},{"type":"WEB","url":"https://git.kernel.org/stable/c/610a2a3d7d8be3537458a378ec69396a76c385b6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/62d11ec205ef14d8acf172cfc9904fdbf200025a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6b0ea3df56cccd53398d0289f399f19d43136b2e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9b3ba54025357440d6c4414c670984f628c6f6bf"},{"type":"WEB","url":"https://git.kernel.org/stable/c/a6f89b10042baca218c8598d6db5a44c7e32625f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b47f5c579c8186f7f5ab5e4254e0734ea5b7bf7a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d464b035c0613856d012cf1704879d3ff3f057fb"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d706485dffbbbf848e681edda29c7a46ac55698c"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50478.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-50478"},{"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":"e339ad31f59925b48a92ee3947692fdf9758b8c7"},{"fixed":"6b0ea3df56cccd53398d0289f399f19d43136b2e"},{"fixed":"a6f89b10042baca218c8598d6db5a44c7e32625f"},{"fixed":"9b3ba54025357440d6c4414c670984f628c6f6bf"},{"fixed":"d706485dffbbbf848e681edda29c7a46ac55698c"},{"fixed":"d464b035c0613856d012cf1704879d3ff3f057fb"},{"fixed":"b47f5c579c8186f7f5ab5e4254e0734ea5b7bf7a"},{"fixed":"1012ff77284e3bec0ec0a35a820b03ec43dec2cc"},{"fixed":"62d11ec205ef14d8acf172cfc9904fdbf200025a"},{"fixed":"610a2a3d7d8be3537458a378ec69396a76c385b6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50478.json"}}],"schema_version":"1.7.5"}