]> git.ipfire.org Git - thirdparty/grub.git/commit
fs/f2fs: Do not read past the end of nat bitmap
authorSudhakar Kuppusamy <sudhakar@linux.ibm.com>
Wed, 6 Apr 2022 13:19:09 +0000 (18:49 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 7 Jun 2022 14:39:33 +0000 (16:39 +0200)
commitdeae293f399dde3773cf37dfa9b77ca7e04ef772
tree8e1f3d81862bd5591dda4e1e73184fa0ba2d8b56
parent4bd9877f62166b7e369773ab92fe24a39f6515f8
fs/f2fs: Do not read past the end of nat bitmap

A corrupt f2fs filesystem could have a block offset or a bitmap
offset that would cause us to read beyond the bounds of the nat
bitmap.

Introduce the nat_bitmap_size member in grub_f2fs_data which holds
the size of nat bitmap.

Set the size when loading the nat bitmap in nat_bitmap_ptr(), and
catch when an invalid offset would create a pointer past the end of
the allocated space.

Check against the bitmap size in grub_f2fs_test_bit() test bit to avoid
reading past the end of the nat bitmap.

Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/f2fs.c