mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 22:34:33 +01:00
isofs: Verify inode mode when loading from disk
Verify that the inode mode is sane when loading it from the disk to avoid complaints from VFS about setting up invalid inodes. Reported-by: [email protected] CC: [email protected] Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/[email protected] Acked-by: Christian Brauner <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
This commit is contained in:
1 parent
6b89819b06
commit
0a9e740513
1 file changed
+8
-1
+8
-1
@@ -1440,9 +1440,16 @@ static int isofs_read_inode(struct inode *inode, int relocated)
|
||||
inode->i_op = &page_symlink_inode_operations;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_data.a_ops = &isofs_symlink_aops;
|
||||
} else
|
||||
} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
|
||||
S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
|
||||
/* XXX - parse_rock_ridge_inode() had already set i_rdev. */
|
||||
init_special_inode(inode, inode->i_mode, inode->i_rdev);
|
||||
} else {
|
||||
printk(KERN_DEBUG "ISOFS: Invalid file type 0%04o for inode %lu.\n",
|
||||
inode->i_mode, inode->i_ino);
|
||||
ret = -EIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
|
||||
Reference in new issue
Block a user