Skip to content

Commit f05f242

Browse files
committed
udf: Fix error handling in udf_new_inode()
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: [email protected] Signed-off-by: Jan Kara <[email protected]>
1 parent b831281 commit f05f242

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/udf/ialloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
7777
GFP_KERNEL);
7878
}
7979
if (!iinfo->i_data) {
80+
make_bad_inode(inode);
8081
iput(inode);
8182
return ERR_PTR(-ENOMEM);
8283
}
@@ -86,6 +87,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
8687
dinfo->i_location.partitionReferenceNum,
8788
start, &err);
8889
if (err) {
90+
make_bad_inode(inode);
8991
iput(inode);
9092
return ERR_PTR(err);
9193
}

0 commit comments

Comments
 (0)