[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] Add more checking when reusing an active grant reference.
# HG changeset patch # User ssmith@xxxxxxxxxxxxxxxxxxxxxxxxxx # Node ID 3f568dd6bda6ee77b5343c855f896b6f94a105da # Parent ba39c2da5e84b11dd49fb38bb26b29ed585532bc [XEN] Add more checking when reusing an active grant reference. Signed-off-by: Steven Smith <sos22@xxxxxxxxx> Based-on-a-patch-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> --- xen/common/grant_table.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff -r ba39c2da5e84 -r 3f568dd6bda6 xen/common/grant_table.c --- a/xen/common/grant_table.c Tue Sep 05 13:57:30 2006 +0100 +++ b/xen/common/grant_table.c Tue Sep 05 14:27:05 2006 +0100 @@ -175,12 +175,13 @@ __gnttab_map_grant_ref( spin_lock(&rd->grant_table->lock); + sdom = sha->domid; + if ( !act->pin || (!(op->flags & GNTMAP_readonly) && !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask))) ) { sflags = sha->flags; - sdom = sha->domid; /* * This loop attempts to set the access (reading/writing) flags @@ -235,6 +236,10 @@ __gnttab_map_grant_ref( act->frame = gmfn_to_mfn(rd, sha->frame); } } + else if ( unlikely(sdom != ld->domain_id) ) + PIN_FAIL(unlock_out, GNTST_general_error, + "Bad domain (%d). (NB. expected dom %d)\n", + sdom, ld->domain_id); else if ( (act->pin & 0x80808080U) != 0 ) PIN_FAIL(unlock_out, ENOSPC, "Risk of counter overflow %08x\n", act->pin); @@ -771,11 +776,12 @@ __acquire_grant_for_copy( spin_lock(&rd->grant_table->lock); + sdom = sha->domid; + if ( !act->pin || (!readonly && !(act->pin & GNTPIN_hstw_mask)) ) { sflags = sha->flags; - sdom = sha->domid; for ( ; ; ) { @@ -819,6 +825,10 @@ __acquire_grant_for_copy( act->frame = gmfn_to_mfn(rd, sha->frame); } } + else if ( unlikely(sdom != current->domain->domain_id) ) + PIN_FAIL(unlock_out, GNTST_general_error, + "Bad domain (%d). (NB. expected dom %d)\n", + sdom, current->domain->domain_id); else if ( (act->pin & 0x80808080U) != 0 ) PIN_FAIL(unlock_out, ENOSPC, "Risk of counter overflow %08x\n", act->pin); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |