Skip to content

Commit 74c8a6a

Browse files
rustylifegregkh
authored andcommitted
ntfs: check for valid standard information attribute
commit 4dfe6bd upstream. Mounting a corrupted filesystem with NTFS resulted in a kernel crash. We should check for valid STANDARD_INFORMATION attribute offset and length before trying to access it Link: https://lkml.kernel.org/r/20210217155930.1506815-1-rkovhaev@gmail.com Link: https://syzkaller.appspot.com/bug?extid=c584225dabdea2f71969 Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com> Reported-by: syzbot+c584225dabdea2f71969@syzkaller.appspotmail.com Tested-by: syzbot+c584225dabdea2f71969@syzkaller.appspotmail.com Acked-by: Anton Altaparmakov <anton@tuxera.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 54a3c25 commit 74c8a6a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fs/ntfs/inode.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ static int ntfs_read_locked_inode(struct inode *vi)
628628
}
629629
a = ctx->attr;
630630
/* Get the standard information attribute value. */
631+
if ((u8 *)a + le16_to_cpu(a->data.resident.value_offset)
632+
+ le32_to_cpu(a->data.resident.value_length) >
633+
(u8 *)ctx->mrec + vol->mft_record_size) {
634+
ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
635+
goto unm_err_out;
636+
}
631637
si = (STANDARD_INFORMATION*)((u8*)a +
632638
le16_to_cpu(a->data.resident.value_offset));
633639

0 commit comments

Comments
 (0)