[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] net/colo-compare.c: Fix a crash in COLO Prim
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH v2] net/colo-compare.c: Fix a crash in COLO Primary. |
Date: |
Sun, 21 Apr 2019 12:13:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 4/20/19 7:14 PM, Lukas Straub wrote:
> From: Lukas Straub <address@hidden>
> Because event_unhandled_count may be accessed concurrently, it needs
> to be protected by taking the lock. However the assert is outside the
> lock, probably causing it to read garbage and aborting Qemu erroneously.
>
> The Bug only happens when running Qemu in COLO mode.
>
> This Patch fixes the following bug:
> https://bugs.launchpad.net/qemu/+bug/1824622
>
> Signed-off-by: Lukas Straub <address@hidden>
> ---
> net/colo-compare.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index bf10526f05..fcb491121b 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)
> break;
> }
>
> - assert(event_unhandled_count > 0);
> -
> qemu_mutex_lock(&event_mtx);
> + assert(event_unhandled_count > 0);
> event_unhandled_count--;
> qemu_cond_broadcast(&event_complete_cond);
> qemu_mutex_unlock(&event_mtx);
> --
> 2.20.1
>
>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>