diff options
author | Tejun Heo <tj@kernel.org> | 2008-11-10 01:28:59 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-11-18 09:08:55 -0500 |
commit | eb60fa1066622ddb2278732cf61e0c4544e82c6f (patch) | |
tree | 4297d3c2e8876897c51843df148725909a356a08 | |
parent | 4e14e833ac3b97a4aa8803eea49f899adc5bb5f4 (diff) |
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.c | 4 |
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, | |||
395 | 395 | ||
396 | err = blk_alloc_devt(p, &devt); | 396 | err = blk_alloc_devt(p, &devt); |
397 | if (err) | 397 | if (err) |
398 | goto out_free; | 398 | goto out_free_stats; |
399 | pdev->devt = devt; | 399 | pdev->devt = devt; |
400 | 400 | ||
401 | /* delay uevent until 'holders' subdir is created */ | 401 | /* delay uevent until 'holders' subdir is created */ |
@@ -426,6 +426,8 @@ int add_partition(struct gendisk *disk, int partno, | |||
426 | 426 | ||
427 | return 0; | 427 | return 0; |
428 | 428 | ||
429 | out_free_stats: | ||
430 | free_part_stats(p); | ||
429 | out_free: | 431 | out_free: |
430 | kfree(p); | 432 | kfree(p); |
431 | return err; | 433 | return err; |