mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
xen: handle out-of-pirq condition correctly in PHYSDEVOP_get_free_pirq
This is XSA-13 / CVE-2012-3495 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Jan Beulich <JBeulich@suse.com>
This commit is contained in:
1 parent
ab4f401a1a
commit
06f0a9bfc3
1 file changed
+8
-3
@@ -587,11 +587,16 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
|
||||
break;
|
||||
|
||||
spin_lock(&d->event_lock);
|
||||
out.pirq = get_free_pirq(d, out.type, 0);
|
||||
d->arch.pirq_irq[out.pirq] = PIRQ_ALLOCATED;
|
||||
ret = get_free_pirq(d, out.type, 0);
|
||||
if ( ret >= 0 )
|
||||
d->arch.pirq_irq[ret] = PIRQ_ALLOCATED;
|
||||
spin_unlock(&d->event_lock);
|
||||
|
||||
ret = copy_to_guest(arg, &out, 1) ? -EFAULT : 0;
|
||||
if ( ret >= 0 )
|
||||
{
|
||||
out.pirq = ret;
|
||||
ret = copy_to_guest(arg, &out, 1) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
rcu_unlock_domain(d);
|
||||
break;
|
||||
|
||||