|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.7] x86/IRQ: conditionally preserve access permission on map error paths
commit 4c937e26faa2edb1d6073efdcb6d4f7d6c66b90a
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 17 17:20:45 2018 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 17 17:20:45 2018 +0100
x86/IRQ: conditionally preserve access permission on map error paths
Permissions that had been granted before should not be revoked when
handling unrelated errors.
Reported-by: HW42 <hw42@xxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
master commit: 3443e68a778572a6e082d7dfcf9ce794eca62f5f
master date: 2018-01-03 11:03:10 +0100
---
xen/arch/x86/irq.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 1b1fc23..fb826c5 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1910,6 +1910,7 @@ int map_domain_pirq(
struct irq_desc *desc;
unsigned long flags;
DECLARE_BITMAP(prepared, MAX_MSI_IRQS) = {};
+ DECLARE_BITMAP(granted, MAX_MSI_IRQS) = {};
ASSERT(spin_is_locked(&d->event_lock));
@@ -1943,13 +1944,17 @@ int map_domain_pirq(
return ret;
}
- ret = irq_permit_access(d, irq);
- if ( ret )
+ if ( likely(!irq_access_permitted(d, irq)) )
{
- printk(XENLOG_G_ERR
- "dom%d: could not permit access to IRQ%d (pirq %d)\n",
- d->domain_id, irq, pirq);
- return ret;
+ ret = irq_permit_access(d, irq);
+ if ( ret )
+ {
+ printk(XENLOG_G_ERR
+ "dom%d: could not permit access to IRQ%d (pirq %d)\n",
+ d->domain_id, irq, pirq);
+ return ret;
+ }
+ __set_bit(0, granted);
}
ret = prepare_domain_irq_pirq(d, irq, pirq, &info);
@@ -2034,10 +2039,15 @@ int map_domain_pirq(
__set_bit(nr, prepared);
msi_desc[nr].irq = irq;
- if ( irq_permit_access(d, irq) != 0 )
- printk(XENLOG_G_WARNING
- "dom%d: could not permit access to IRQ%d (pirq %d)\n",
- d->domain_id, irq, pirq);
+ if ( likely(!irq_access_permitted(d, irq)) )
+ {
+ if ( irq_permit_access(d, irq) )
+ printk(XENLOG_G_WARNING
+ "dom%d: could not permit access to IRQ%d (pirq
%d)\n",
+ d->domain_id, irq, pirq);
+ else
+ __set_bit(nr, granted);
+ }
desc = irq_to_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
@@ -2066,7 +2076,8 @@ int map_domain_pirq(
}
while ( nr )
{
- if ( irq >= 0 && irq_deny_access(d, irq) )
+ if ( irq >= 0 && test_bit(nr, granted) &&
+ irq_deny_access(d, irq) )
printk(XENLOG_G_ERR
"dom%d: could not revoke access to IRQ%d (pirq
%d)\n",
d->domain_id, irq, pirq);
@@ -2097,7 +2108,7 @@ done:
if ( test_bit(0, prepared) )
cleanup_domain_irq_pirq(d, irq, info);
revoke:
- if ( irq_deny_access(d, irq) )
+ if ( test_bit(0, granted) && irq_deny_access(d, irq) )
printk(XENLOG_G_ERR
"dom%d: could not revoke access to IRQ%d (pirq %d)\n",
d->domain_id, irq, pirq);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |