diff options
author | Wu Bo <wubo40@huawei.com> | 2021-11-04 09:07:09 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-11-04 12:45:41 +0100 |
commit | 27548088ac628109f70eb0b1eb521d035844dba8 (patch) | |
tree | d7d34ad98a5b65bcd1ed3a058dc35f86b58f94e2 /drivers/block/drbd | |
parent | nvdimm/btt: do not call del_gendisk() if not needed (diff) | |
download | linux-27548088ac628109f70eb0b1eb521d035844dba8.tar.xz linux-27548088ac628109f70eb0b1eb521d035844dba8.zip |
drbd: Fix double free problem in drbd_create_device
In drbd_create_device(), the 'out_no_io_page' lable has called
blk_cleanup_disk() when return failed.
So remove the 'out_cleanup_disk' lable to avoid double free the
disk pointer.
Fixes: e92ab4eda516 ("drbd: add error handling support for add_disk()")
Signed-off-by: Wu Bo <wubo40@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/1636013229-26309-1-git-send-email-wubo40@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 19db80a1e409..53ba2dddba6e 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2796,7 +2796,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig err = add_disk(disk); if (err) - goto out_cleanup_disk; + goto out_idr_remove_vol; /* inherit the connection state */ device->state.conn = first_connection(resource)->cstate; @@ -2810,8 +2810,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig drbd_debugfs_device_add(device); return NO_ERROR; -out_cleanup_disk: - blk_cleanup_disk(disk); out_idr_remove_vol: idr_remove(&connection->peer_devices, vnr); out_idr_remove_from_resource: |