Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
udf: fix an uninitialized read bug and remove dead code
Browse files Browse the repository at this point in the history
In udf_lookup(), the pointer 'fi' is a local variable initialized by the
return value of the function call udf_find_entry(). However, if the macro
'UDF_RECOVERY' is defined, this variable will become uninitialized if the
else branch is not taken, which can potentially cause incorrect results in
the following execution.

To fix this issue, this patch drops the whole code in the ifdef
'UDF_RECOVERY' region, as it is dead code.

Signed-off-by: Wenwen Wang <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
Wenwen Wang authored and jankara committed Apr 17, 2019
1 parent 5d552ad commit 39416c5
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions fs/udf/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,21 +304,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
if (dentry->d_name.len > UDF_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);

#ifdef UDF_RECOVERY
/* temporary shorthand for specifying files by inode number */
if (!strncmp(dentry->d_name.name, ".B=", 3)) {
struct kernel_lb_addr lb = {
.logicalBlockNum = 0,
.partitionReferenceNum =
simple_strtoul(dentry->d_name.name + 3,
NULL, 0),
};
inode = udf_iget(dir->i_sb, lb);
if (IS_ERR(inode))
return inode;
} else
#endif /* UDF_RECOVERY */

fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
if (IS_ERR(fi))
return ERR_CAST(fi);
Expand Down

0 comments on commit 39416c5

Please sign in to comment.