[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] ide: check BlockBackend object in ide_cancel_dm
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] ide: check BlockBackend object in ide_cancel_dma_sync |
Date: |
Mon, 17 Jul 2017 10:49:35 +0100 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Fri, Jul 14, 2017 at 03:30:29PM +0530, P J P wrote:
> From: Prasad J Pandit <address@hidden>
>
> When cancelling pending DMA requests in ide_cancel_dma_sync,
> the s->blk object could be null, leading to a null dereference.
> Add check to avoid it.
Please include details on how to reproduce the bug and/or which code
path triggers this NULL dereference.
> Reported-by: Chensongnian <address@hidden>
> Signed-off-by: Prasad J Pandit <address@hidden>
> ---
> hw/ide/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 0b48b64..04474b3 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -681,8 +681,10 @@ void ide_cancel_dma_sync(IDEState *s)
> #ifdef DEBUG_IDE
> printf("%s: draining all remaining requests", __func__);
> #endif
> - blk_drain(s->blk);
> - assert(s->bus->dma->aiocb == NULL);
> + if (s->blk) {
> + blk_drain(s->blk);
> + assert(s->bus->dma->aiocb == NULL);
> + }
> }
> }
>
> --
> 2.9.4
>
>
signature.asc
Description: PGP signature