diff mbox

exec: Add missing rcu_read_unlock

Message ID 20170109110921.4931-1-rka@sysgo.com
State New
Headers show

Commit Message

Roman Kapl Jan. 9, 2017, 11:09 a.m. UTC
rcu_read_unlock was not called if the address_space_access_valid result is
negative.

This caused (at least) a problem when qemu on PPC/E500+TAP failed to terminate
properly and instead got stuck in a deadlock.

Signed-off-by: Roman Kapl <rka@sysgo.com>
---
 exec.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Bonzini Jan. 9, 2017, 11:52 a.m. UTC | #1
On 09/01/2017 12:09, Roman Kapl wrote:
> rcu_read_unlock was not called if the address_space_access_valid result is
> negative.
> 
> This caused (at least) a problem when qemu on PPC/E500+TAP failed to terminate
> properly and instead got stuck in a deadlock.
> 
> Signed-off-by: Roman Kapl <rka@sysgo.com>
> ---
>  exec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/exec.c b/exec.c
> index 8d4bb0e..6895db5 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2927,6 +2927,7 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
>          if (!memory_access_is_direct(mr, is_write)) {
>              l = memory_access_size(mr, l, addr);
>              if (!memory_region_access_valid(mr, xlat, l, is_write)) {
> +                rcu_read_unlock();
>                  return false;
>              }
>          }
> 

Thanks, queued!

Cc: qemu-stable <qemu-stable@nongnu.org>

Paolo
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 8d4bb0e..6895db5 100644
--- a/exec.c
+++ b/exec.c
@@ -2927,6 +2927,7 @@  bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
         if (!memory_access_is_direct(mr, is_write)) {
             l = memory_access_size(mr, l, addr);
             if (!memory_region_access_valid(mr, xlat, l, is_write)) {
+                rcu_read_unlock();
                 return false;
             }
         }