mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
ntfs: check for valid standard information attribute
commit 4dfe6bd949
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>
This commit is contained in:
parent
54a3c25368
commit
74c8a6af69
1 changed files with 6 additions and 0 deletions
|
@ -628,6 +628,12 @@ static int ntfs_read_locked_inode(struct inode *vi)
|
|||
}
|
||||
a = ctx->attr;
|
||||
/* Get the standard information attribute value. */
|
||||
if ((u8 *)a + le16_to_cpu(a->data.resident.value_offset)
|
||||
+ le32_to_cpu(a->data.resident.value_length) >
|
||||
(u8 *)ctx->mrec + vol->mft_record_size) {
|
||||
ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
|
||||
goto unm_err_out;
|
||||
}
|
||||
si = (STANDARD_INFORMATION*)((u8*)a +
|
||||
le16_to_cpu(a->data.resident.value_offset));
|
||||
|
||||
|
|
Loading…
Reference in a new issue