mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
udf: Fix error handling in udf_new_inode()
[ Upstream commit f05f2429ee
]
When memory allocation of iinfo or block allocation fails, already
allocated struct udf_inode_info gets freed with iput() and
udf_evict_inode() may look at inode fields which are not properly
initialized. Fix it by marking inode bad before dropping reference to it
in udf_new_inode().
Reported-by: syzbot+9ca499bb57a2b9e4c652@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
2f40529bb2
commit
25d817e617
1 changed files with 2 additions and 0 deletions
|
@ -77,6 +77,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
|
|||
GFP_KERNEL);
|
||||
}
|
||||
if (!iinfo->i_data) {
|
||||
make_bad_inode(inode);
|
||||
iput(inode);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
@ -86,6 +87,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
|
|||
dinfo->i_location.partitionReferenceNum,
|
||||
start, &err);
|
||||
if (err) {
|
||||
make_bad_inode(inode);
|
||||
iput(inode);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue