udf: Fix error handling in udf_new_inode()
authorJan Kara <jack@suse.cz>
Tue, 14 Dec 2021 10:04:29 +0000 (11:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:02 +0000 (11:05 +0100)
commit9de7569942cc7960755d21e61661b7b7ba4757da
tree185f110ed2587b3df9eb7c143e2772d1db4432f5
parent625be247e81249ec92d8bf8db17e6ee724c48099
udf: Fix error handling in udf_new_inode()

[ Upstream commit f05f2429eec60851b98bdde213de31dab697c01b ]

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>
fs/udf/ialloc.c