diff options
author | Jan Kara <jack@suse.cz> | 2021-10-18 13:37:41 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-12 16:58:33 +0300 |
commit | 86d4aedcbc69c0f84551fb70f953c24e396de2d7 (patch) | |
tree | 213e23a1db58b6bbffb9e187c8cfdf87e5411197 /fs/isofs | |
parent | c430094541a80575259a94ff879063ef01473506 (diff) | |
download | linux-86d4aedcbc69c0f84551fb70f953c24e396de2d7.tar.xz |
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/isofs')
-rw-r--r-- | fs/isofs/inode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 35675a1065be..f62b5a501566 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -1321,6 +1321,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; |