On 05/03/18 19:36, Paolo Bonzini wrote:
> address_space_map is calling address_space_to_flatview but it can
> be called outside the RCU lock. The function itself is calling
> rcu_read_lock/rcu_read_unlock, just in the wrong place, so the
> fix is easy.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> exec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index 177583c2ee..070eaff3e7 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3464,7 +3464,7 @@ void *address_space_map(AddressSpace *as,
> hwaddr l, xlat;
> MemoryRegion *mr;
> void *ptr;
> - FlatView *fv = address_space_to_flatview(as);
> + FlatView *fv;
>
> if (len == 0) {
> return NULL;
> @@ -3472,6 +3472,7 @@ void *address_space_map(AddressSpace *as,
>
> l = len;
> rcu_read_lock();
> + fv = address_space_to_flatview(as);
> mr = flatview_translate(fv, addr, &xlat, &l, is_write);
>
> if (!memory_access_is_direct(mr, is_write)) {
>
--
Alexey