|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: fix RCU locking in PHYSDEVOP_get_free_pirq
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1346850588 -7200
# Node ID cbc0c2368a6d1984c4d48a9d5554372be8c49e17
# Parent aa69843f0b0296a684be4167fc1f0d03f0f74779
x86: fix RCU locking in PHYSDEVOP_get_free_pirq
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@xxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---
diff -r aa69843f0b02 -r cbc0c2368a6d xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c Wed Sep 05 15:07:42 2012 +0200
+++ b/xen/arch/x86/physdev.c Wed Sep 05 15:09:48 2012 +0200
@@ -698,13 +698,13 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
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 )
{
@@ -715,7 +715,9 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
else
ret = -ENOMEM;
}
+
spin_unlock(&d->event_lock);
+ rcu_unlock_domain(d);
if ( ret >= 0 )
{
@@ -723,7 +725,6 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
ret = copy_to_guest(arg, &out, 1) ? -EFAULT : 0;
}
- rcu_unlock_domain(d);
break;
}
default:
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |