aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-04-01 22:48:44 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-04-10 00:36:49 +0200
commitaba5288247add3fccc089f21ea8b41f48556c184 (patch)
treea4fa67b6e0b00575ebe5374e033e1f3ec380d761 /block.c
parent4f7cb969319be00ffce3dee6426d1b4ae95d2d83 (diff)
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 <kwolf@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit cb6d3ca07b8f62b47ef30c6a92caa3e8bd71248b)
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index 9697dc9c3d..06e22a6155 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);
}