rbd: Fix leaks in rbd_start_aio() error path
PATCH v2 1/1 rbd: Fix leaks in rbd_start_aio() error path
Signed-off-by Kevin Wolf <[email protected]>
--- block/rbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/rbd.c +4 -1
@@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, }if (r <0 ) { - goto failed; + goto failed_completion; }return &acb->common; +failed_completion: +rbd_aio_release (c); failed:g_free (rcb); +qemu_vfree (acb->bounce);qemu_aio_release (acb);return NULL ; }
Signature · 1 line
1.8.3.1
Quoted 30 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/rbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)block/rbd.c +4
-1@@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, }if (r <0 ) { - goto failed; + goto failed_completion; }return &acb->common; +failed_completion: +rbd_aio_release (c); failed:g_free (rcb); +qemu_vfree (acb->bounce);qemu_aio_release (acb);return NULL ; }Signature · 1 line
1.8.3.1
Reviewed-by Benoit Canet <[email protected]>
Quoted 18 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/rbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)block/rbd.c +1
-1@@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, }if (r <0 ) { - goto failed; + goto failed_completion; }
block/rbd.c static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, · line 699
Quoted 10 lines
block/rbd.c +3
-0return &acb->common; +failed_completion: +rbd_aio_release (c); failed:g_free (rcb); +qemu_vfree (acb->bounce);qemu_aio_release (acb);return NULL ; }
Reviewed-by Josh Durgin <[email protected]>
FWIW this error path can only happen in certain combinations of odd circumstances, including specific forms of disk corruption of certain objects in concert with other factors, so it's quite unlikely to occur in practice.
Stefan Hajnoczi
AppliedQuoted 4 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/rbd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
(It seems I forgot to reply last week when I merged this.)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan