Skip to content

Commit

Permalink
UDF: Fix a null pointer dereference in udf_sb_free_partitions
Browse files Browse the repository at this point in the history
This patch fixes a regression caused by commit bff943a "udf: Fix memory
leak when mounting" due to which it was triggering a kernel null point
dereference in case of interrupted mount OR when allocating memory to
sbi->s_partmaps failed in function udf_sb_alloc_partition_maps.

Reported-and-tested-by: James Hogan <james@albanarts.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Namjae Jeon authored and Jan Kara committed Jan 14, 2013
1 parent 7e2fb2d commit 1b1baff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/udf/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ static void udf_sb_free_partitions(struct super_block *sb)
{
struct udf_sb_info *sbi = UDF_SB(sb);
int i;

if (sbi->s_partmaps == NULL)
return;
for (i = 0; i < sbi->s_partitions; i++)
udf_free_partition(&sbi->s_partmaps[i]);
kfree(sbi->s_partmaps);
Expand Down

0 comments on commit 1b1baff

Please sign in to comment.