Skip to content

Commit 2d04df8

Browse files
ea1daviskleikamp
authored andcommitted
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: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=630f6d40b3ccabc8e96e Tested-by: [email protected] Signed-off-by: Edward Adam Davis <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent c214006 commit 2d04df8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/jfs/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ static int jfs_open(struct inode *inode, struct file *file)
4444
{
4545
int rc;
4646

47+
if (S_ISREG(inode->i_mode) && inode->i_size < 0)
48+
return -EIO;
49+
4750
if ((rc = dquot_file_open(inode, file)))
4851
return rc;
4952

0 commit comments

Comments
 (0)