summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-11-10 07:28:59 +0100
committerJens Axboe <jens.axboe@oracle.com>2008-11-18 15:08:55 +0100
commiteb60fa1066622ddb2278732cf61e0c4544e82c6f (patch)
tree4297d3c2e8876897c51843df148725909a356a08
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6 (diff)
downloadlinux-eb60fa1066622ddb2278732cf61e0c4544e82c6f.tar.xz
linux-eb60fa1066622ddb2278732cf61e0c4544e82c6f.zip
block: fix add_partition() error path
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>
-rw-r--r--fs/partitions/check.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 633f7a0ebb2c..90bcf136a9de 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -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 */
@@ -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;