Commit 2d04df81 authored by Edward Adam Davis's avatar Edward Adam Davis Committed by Dave Kleikamp
Browse files

jfs: Regular file corruption check



The reproducer builds a corrupted file on disk with a negative i_size value.
Add a check when opening this file to avoid subsequent operation failures.

Reported-by: default avatar <syzbot+630f6d40b3ccabc8e96e@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=630f6d40b3ccabc8e96e


Tested-by: default avatar <syzbot+630f6d40b3ccabc8e96e@syzkaller.appspotmail.com>
Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
parent c2140068
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ static int jfs_open(struct inode *inode, struct file *file)
{
	int rc;

	if (S_ISREG(inode->i_mode) && inode->i_size < 0)
		return -EIO;

	if ((rc = dquot_file_open(inode, file)))
		return rc;