Skip to content

Commit 557d196

Browse files
nifeyaalexandrovich
authored andcommitted
fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs
Syzbot reports an out of bound access in ntfs_trim_fs. The cause of this is using a loop termination condition that compares window index (iw) with wnd->nbits instead of wnd->nwnd, due to which the index used for wnd->free_bits exceeds the size of the array allocated. Fix the loop condition. Fixes: 3f3b442 ("fs/ntfs3: Add bitmap") Link: https://syzkaller.appspot.com/bug?extid=b892240eac461e488d51 Reported-by: [email protected] Signed-off-by: Abdun Nihaal <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent bfcdbae commit 557d196

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ntfs3/bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ int ntfs_trim_fs(struct ntfs_sb_info *sbi, struct fstrim_range *range)
14241424

14251425
down_read_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS);
14261426

1427-
for (; iw < wnd->nbits; iw++, wbit = 0) {
1427+
for (; iw < wnd->nwnd; iw++, wbit = 0) {
14281428
CLST lcn_wnd = iw * wbits;
14291429
struct buffer_head *bh;
14301430

0 commit comments

Comments
 (0)