From aba5288247add3fccc089f21ea8b41f48556c184 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 1 Apr 2010 22:48:44 +0200 Subject: [PATCH] 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 (cherry picked from commit cb6d3ca07b8f62b47ef30c6a92caa3e8bd71248b) --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 9697dc9c3d8..06e22a6155a 100644 --- a/block.c +++ b/block.c @@ -1617,7 +1617,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); } -- 2.39.5