[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2] util/async: avoid NULL pointer dereference
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH v2] util/async: avoid NULL pointer dereference |
Date: |
Mon, 18 Jun 2018 16:50:45 +0100 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
On Tue, Jun 12, 2018 at 07:26:25AM +0800, Jie Wang wrote:
> if laio_init create linux_aio failed and return NULL, NULL pointer
> dereference will occur when laio_attach_aio_context dereference
> linux_aio in aio_get_linux_aio. Let's avoid it and report error.
>
> Signed-off-by: Jie Wang <address@hidden>
> ---
> block/file-posix.c | 19 +++++++++++++++++--
> util/async.c | 5 ++++-
> 2 files changed, 21 insertions(+), 3 deletions(-)
If someone wants to split aio_get_linux_aio() into an initialization
function and a "get" function which doesn't return NULL if init
succeeded, then we can make this a bit cleaner. But it doesn't matter
at the moment since there are few callers and duplicating the NULL check
isn't too bad.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
signature.asc
Description: PGP signature