summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2021-10-18 12:37:41 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-12 14:40:50 +0100
commitb0ddff8d68f2e43857a84dce54c3deab181c8ae1 (patch)
treee758cc7ed80cf8cf4a860015d580e6870a1588a1 /fs
parenta9342139ac906e97675bb250ce69e0e683504943 (diff)
isofs: Fix out of bound access for corrupted isofs image
commit e96a1866b40570b5950cda8602c2819189c62a48 upstream. When isofs image is suitably corrupted isofs_read_inode() can read data beyond the end of buffer. Sanity-check the directory entry length before using it. Reported-and-tested-by: syzbot+6fc7fb214625d82af7d1@syzkaller.appspotmail.com CC: stable@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/isofs/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 2355ad62b81f..6e4e2cfd40b9 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1326,6 +1326,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *) de;
+ if (de_len < sizeof(struct iso_directory_record))
+ goto fail;
if (offset + de_len > bufsize) {
int frag1 = bufsize - offset;