mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
udf: Detect system inodes linked into directory hierarchy
[ Upstream commit 85a37983ec
]
When UDF filesystem is corrupted, hidden system inodes can be linked
into directory hierarchy which is an avenue for further serious
corruption of the filesystem and kernel confusion as noticed by syzbot
fuzzed images. Refuse to access system inodes linked into directory
hierarchy and vice versa.
CC: stable@vger.kernel.org
Reported-by: syzbot+38695a20b8addcbc1084@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ec852375bb
commit
1dc71eeb19
@ -1871,8 +1871,13 @@ struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
|
|||||||
if (!inode)
|
if (!inode)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
if (!(inode->i_state & I_NEW))
|
if (!(inode->i_state & I_NEW)) {
|
||||||
|
if (UDF_I(inode)->i_hidden != hidden_inode) {
|
||||||
|
iput(inode);
|
||||||
|
return ERR_PTR(-EFSCORRUPTED);
|
||||||
|
}
|
||||||
return inode;
|
return inode;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr));
|
memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr));
|
||||||
err = udf_read_inode(inode, hidden_inode);
|
err = udf_read_inode(inode, hidden_inode);
|
||||||
|
Loading…
Reference in New Issue
Block a user