diff options
| author | Prasad J Pandit | 2020-05-26 13:17:43 +0200 |
|---|---|---|
| committer | Paolo Bonzini | 2020-06-10 18:10:50 +0200 |
| commit | 77f55eac6c433e23e82a1b88b2d74f385c4c7d82 (patch) | |
| tree | f0a31aa10d21136397cee350fe1c56006a5d20f3 /exec.c | |
| parent | configure: Do not ignore malloc value (diff) | |
| download | qemu-77f55eac6c433e23e82a1b88b2d74f385c4c7d82.tar.gz qemu-77f55eac6c433e23e82a1b88b2d74f385c4c7d82.tar.xz qemu-77f55eac6c433e23e82a1b88b2d74f385c4c7d82.zip | |
exec: set map length to zero when returning NULL
When mapping physical memory into host's virtual address space,
'address_space_map' may return NULL if BounceBuffer is in_use.
Set and return '*plen = 0' to avoid later NULL pointer dereference.
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Fixes: https://bugs.launchpad.net/qemu/+bug/1878259
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <20200526111743.428367-1-ppandit@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
| -rw-r--r-- | exec.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -3540,6 +3540,7 @@ void *address_space_map(AddressSpace *as, if (!memory_access_is_direct(mr, is_write)) { if (atomic_xchg(&bounce.in_use, true)) { + *plen = 0; return NULL; } /* Avoid unbounded allocations */ |
