Apart from properly pairing locks with unlocks, also reduce the lock
scope - no need to do the copy_{from,to}_guest()-s inside the protected
region.
I actually wonder whether the RCU locks are needed here at all.
Reported-by: Tim Deegan <tim@xen.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
struct physdev_get_free_pirq out;
struct domain *d;
- d = rcu_lock_current_domain();
-
ret = -EFAULT;
if ( copy_from_guest(&out, arg, 1) != 0 )
break;
+ d = rcu_lock_current_domain();
spin_lock(&d->event_lock);
+
ret = get_free_pirq(d, out.type);
if ( ret >= 0 )
{
else
ret = -ENOMEM;
}
+
spin_unlock(&d->event_lock);
+ rcu_unlock_domain(d);
if ( ret >= 0 )
{
ret = copy_to_guest(arg, &out, 1) ? -EFAULT : 0;
}
- rcu_unlock_domain(d);
break;
}
default: