提交 eb60fa10 编写于 作者: T Tejun Heo 提交者: Jens Axboe

block: fix add_partition() error path

Partition stats structure was not freed on devt allocation failure
path.  Fix it.
Signed-off-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 4e14e833
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册