* [PATCH] drbd: Fix double free problem in drbd_create_device
@ 2021-11-04 8:07 Wu Bo
2021-11-04 8:47 ` Christoph Hellwig
2021-11-04 11:45 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Wu Bo @ 2021-11-04 8:07 UTC (permalink / raw)
To: lars.ellenberg, axboe
Cc: mcgrof, linux-block, linux-kernel, linfeilong, wubo40
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>
---
drivers/block/drbd/drbd_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 19db80a..53ba2dd 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:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drbd: Fix double free problem in drbd_create_device
2021-11-04 8:07 [PATCH] drbd: Fix double free problem in drbd_create_device Wu Bo
@ 2021-11-04 8:47 ` Christoph Hellwig
2021-11-04 11:45 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-11-04 8:47 UTC (permalink / raw)
To: Wu Bo
Cc: lars.ellenberg, axboe, mcgrof, linux-block, linux-kernel, linfeilong
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drbd: Fix double free problem in drbd_create_device
2021-11-04 8:07 [PATCH] drbd: Fix double free problem in drbd_create_device Wu Bo
2021-11-04 8:47 ` Christoph Hellwig
@ 2021-11-04 11:45 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-11-04 11:45 UTC (permalink / raw)
To: lars.ellenberg, Wu Bo; +Cc: linux-kernel, mcgrof, linfeilong, linux-block
On Thu, 4 Nov 2021 16:07:09 +0800, Wu Bo wrote:
> 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.
>
>
> [...]
Applied, thanks!
[1/1] drbd: Fix double free problem in drbd_create_device
commit: 27548088ac628109f70eb0b1eb521d035844dba8
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-04 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 8:07 [PATCH] drbd: Fix double free problem in drbd_create_device Wu Bo
2021-11-04 8:47 ` Christoph Hellwig
2021-11-04 11:45 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).