From: Kevin Wolf Date: Thu, 1 Apr 2010 20:48:44 +0000 (+0200) Subject: block: Fix multiwrite error handling X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cb6d3ca07b8f62b47ef30c6a92caa3e8bd71248b;p=qemu.git block: Fix multiwrite error handling When two requests of the same multiwrite batch fail, the callback of all requests in that batch were called twice. This could have any kind of nasty effects, in my case it lead to use after free and eventually a segfault. Signed-off-by: Kevin Wolf Signed-off-by: Aurelien Jarno --- diff --git a/block.c b/block.c index e891544dd1..06ed08ad88 100644 --- a/block.c +++ b/block.c @@ -1740,7 +1740,7 @@ static void multiwrite_cb(void *opaque, int ret) { MultiwriteCB *mcb = opaque; - if (ret < 0) { + if (ret < 0 && !mcb->error) { mcb->error = ret; multiwrite_user_cb(mcb); }