Skip to content

Commit fa236c2

Browse files
Arturo Giustijankara
authored andcommitted
udf: Fix NULL pointer dereference in udf_symlink function
In function udf_symlink, epos.bh is assigned with the value returned by udf_tgetblk. The function udf_tgetblk is defined in udf/misc.c and returns the value of sb_getblk function that could be NULL. Then, epos.bh is used without any check, causing a possible NULL pointer dereference when sb_getblk fails. This fix adds a check to validate the value of epos.bh. Link: https://bugzilla.kernel.org/show_bug.cgi?id=213083 Signed-off-by: Arturo Giusti <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent a149127 commit fa236c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/udf/namei.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,10 @@ static int udf_symlink(struct user_namespace *mnt_userns, struct inode *dir,
934934
iinfo->i_location.partitionReferenceNum,
935935
0);
936936
epos.bh = udf_tgetblk(sb, block);
937+
if (unlikely(!epos.bh)) {
938+
err = -ENOMEM;
939+
goto out_no_entry;
940+
}
937941
lock_buffer(epos.bh);
938942
memset(epos.bh->b_data, 0x00, bsize);
939943
set_buffer_uptodate(epos.bh);

0 commit comments

Comments
 (0)