Patchwork linux-aio: Fix laio_submit error handling

login
register
mail settings
Submitter Kevin Wolf
Date Sept. 22, 2011, 12:24 p.m.
Message ID <1316694278-4265-1-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/115941/
State New
Headers show

Comments

Kevin Wolf - Sept. 22, 2011, 12:24 p.m.
The error handling order was in the wrong order, so that either the ACB would
be leaked or the counter would be decremented when it shouldn't.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 linux-aio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/linux-aio.c b/linux-aio.c
index bffa6cd..50da75d 100644
--- a/linux-aio.c
+++ b/linux-aio.c
@@ -185,10 +185,10 @@  BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
         goto out_dec_count;
     return &laiocb->common;
 
-out_free_aiocb:
-    qemu_aio_release(laiocb);
 out_dec_count:
     s->count--;
+out_free_aiocb:
+    qemu_aio_release(laiocb);
     return NULL;
 }