udf: Avoid accessing uninitialized data on failed inode read
When we fail to read inode, some data accessed in udf_evict_inode() may be uninitialized. Move the accesses to !is_bad_inode() branch. Reported-by: syzbot+91f02b28f9bb5f5f1341@syzkaller.appspotmail.com Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Родитель
3d3dc274ce
Коммит
044e2e26f2
|
@ -139,21 +139,24 @@ void udf_evict_inode(struct inode *inode)
|
||||||
struct udf_inode_info *iinfo = UDF_I(inode);
|
struct udf_inode_info *iinfo = UDF_I(inode);
|
||||||
int want_delete = 0;
|
int want_delete = 0;
|
||||||
|
|
||||||
if (!inode->i_nlink && !is_bad_inode(inode)) {
|
if (!is_bad_inode(inode)) {
|
||||||
want_delete = 1;
|
if (!inode->i_nlink) {
|
||||||
udf_setsize(inode, 0);
|
want_delete = 1;
|
||||||
udf_update_inode(inode, IS_SYNC(inode));
|
udf_setsize(inode, 0);
|
||||||
|
udf_update_inode(inode, IS_SYNC(inode));
|
||||||
|
}
|
||||||
|
if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB &&
|
||||||
|
inode->i_size != iinfo->i_lenExtents) {
|
||||||
|
udf_warn(inode->i_sb,
|
||||||
|
"Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n",
|
||||||
|
inode->i_ino, inode->i_mode,
|
||||||
|
(unsigned long long)inode->i_size,
|
||||||
|
(unsigned long long)iinfo->i_lenExtents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
truncate_inode_pages_final(&inode->i_data);
|
truncate_inode_pages_final(&inode->i_data);
|
||||||
invalidate_inode_buffers(inode);
|
invalidate_inode_buffers(inode);
|
||||||
clear_inode(inode);
|
clear_inode(inode);
|
||||||
if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB &&
|
|
||||||
inode->i_size != iinfo->i_lenExtents) {
|
|
||||||
udf_warn(inode->i_sb, "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n",
|
|
||||||
inode->i_ino, inode->i_mode,
|
|
||||||
(unsigned long long)inode->i_size,
|
|
||||||
(unsigned long long)iinfo->i_lenExtents);
|
|
||||||
}
|
|
||||||
kfree(iinfo->i_ext.i_data);
|
kfree(iinfo->i_ext.i_data);
|
||||||
iinfo->i_ext.i_data = NULL;
|
iinfo->i_ext.i_data = NULL;
|
||||||
udf_clear_extent_cache(inode);
|
udf_clear_extent_cache(inode);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче