Skip to content

Commit

Permalink
block: fix add_partition() error path
Browse files Browse the repository at this point in the history
Partition stats structure was not freed on devt allocation failure
path.  Fix it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Nov 18, 2008
1 parent 4e14e83 commit eb60fa1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int add_partition(struct gendisk *disk, int partno,

err = blk_alloc_devt(p, &devt);
if (err)
goto out_free;
goto out_free_stats;
pdev->devt = devt;

/* delay uevent until 'holders' subdir is created */
Expand Down Expand Up @@ -426,6 +426,8 @@ int add_partition(struct gendisk *disk, int partno,

return 0;

out_free_stats:
free_part_stats(p);
out_free:
kfree(p);
return err;
Expand Down

0 comments on commit eb60fa1

Please sign in to comment.