mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
cramfs: Verify inode mode when loading from disk
[ Upstream commit7f9d34b0a7] The inode mode loaded from corrupted disk can be invalid. Do like what commit0a9e740513("isofs: Verify inode mode when loading from disk") does. Reported-by: syzbot <syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com> Closes: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Link: https://lore.kernel.org/429b3ef1-13de-4310-9a8e-c2dc9a36234a@I-love.SAKURA.ne.jp Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a05855302b
commit
4bdabd52ca
@@ -117,9 +117,18 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
|
||||
inode_nohighmem(inode);
|
||||
inode->i_data.a_ops = &cramfs_aops;
|
||||
break;
|
||||
default:
|
||||
case S_IFCHR:
|
||||
case S_IFBLK:
|
||||
case S_IFIFO:
|
||||
case S_IFSOCK:
|
||||
init_special_inode(inode, cramfs_inode->mode,
|
||||
old_decode_dev(cramfs_inode->size));
|
||||
break;
|
||||
default:
|
||||
printk(KERN_DEBUG "CRAMFS: Invalid file type 0%04o for inode %lu.\n",
|
||||
inode->i_mode, inode->i_ino);
|
||||
iget_failed(inode);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
|
||||
inode->i_mode = cramfs_inode->mode;
|
||||
|
||||
Reference in New Issue
Block a user