Skip to content

Commit 2754808

Browse files
Wu Boaxboe
authored andcommitted
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: e92ab4e ("drbd: add error handling support for add_disk()") Signed-off-by: Wu Bo <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 3aefb5e commit 2754808

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/block/drbd/drbd_main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
27962796

27972797
err = add_disk(disk);
27982798
if (err)
2799-
goto out_cleanup_disk;
2799+
goto out_idr_remove_vol;
28002800

28012801
/* inherit the connection state */
28022802
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
28102810
drbd_debugfs_device_add(device);
28112811
return NO_ERROR;
28122812

2813-
out_cleanup_disk:
2814-
blk_cleanup_disk(disk);
28152813
out_idr_remove_vol:
28162814
idr_remove(&connection->peer_devices, vnr);
28172815
out_idr_remove_from_resource:

0 commit comments

Comments
 (0)