Skip to contentSkip to conversation

rbd: Fix leaks in rbd_start_aio() error path

PATCH Superseded Kevin Wolf 2 participants 3 messages Jun 5, 2014 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 rbd: Fix leaks in rbd_start_aio() error path

---
 block/rbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/rbd.c +4 -1
index 09af484..94e2bfd 100644
@@ -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);
+    g_free(acb->bounce);
     qemu_aio_release(acb);
     return NULL;
 }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · Kevin Wolf
---
 block/rbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/rbd.c +0 -1
index 09af484..94e2bfd 100644
@@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
     }
 
     if (r < 0) {
-        goto failed;

block/rbd.c static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, · line 696

Quoted 10 lines
block/rbd.c +4 -0
+        goto failed_completion;
     }
 
     return &acb->common;
 
+failed_completion:
+    rbd_aio_release(c);
 failed:
     g_free(rcb);
+    g_free(acb->bounce);

Err, Isn't it blockaligned ? (qemu_vfree) ?

Quoted 7 lines
block/rbd.c +0 -0
     qemu_aio_release(acb);
     return NULL;
 }
Signature · 1 line
1.8.3.1
author
#2 lore raw

Am 05.06.2014 um 16:15 hat Benoît Canet geschrieben:

Quoted 20 lines
Quoted 19 lines · Kevin Wolf
---
 block/rbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/rbd.c +1 -1
index 09af484..94e2bfd 100644
@@ -684,13 +684,16 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
     }
 
     if (r < 0) {
-        goto failed;
+        goto failed_completion;
     }
 
     return &acb->common;
 
Quoted 7 lines

block/rbd.c static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, · line 696

Quoted 5 lines
block/rbd.c +3 -0
+failed_completion:
+    rbd_aio_release(c);
 failed:
     g_free(rcb);
+    g_free(acb->bounce);

Err, Isn't it blockaligned ? (qemu_vfree) ?

*sigh* Yes, the patch was too trivial to get it right. Thanks for catching this.

Kevin