ia64/xen-unstable

changeset 12533:08007423788a

[XEN] Fix potential crash in grant-table code if
guest misbehaves and implicitly unmaps a PTE.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Nov 21 16:14:53 2006 +0000 (2006-11-21)
parents 0747d0b11232
children b80f00215bba
files xen/common/grant_table.c
line diff
     1.1 --- a/xen/common/grant_table.c	Tue Nov 21 15:03:09 2006 +0000
     1.2 +++ b/xen/common/grant_table.c	Tue Nov 21 16:14:53 2006 +0000
     1.3 @@ -371,10 +371,9 @@ static void
     1.4  
     1.5      if ( unlikely((rd = find_domain_by_id(dom)) == NULL) )
     1.6      {
     1.7 -        if ( rd != NULL )
     1.8 -            put_domain(rd);
     1.9 +        /* This can happen when a grant is implicitly unmapped. */
    1.10          gdprintk(XENLOG_INFO, "Could not find domain %d\n", dom);
    1.11 -        op->status = GNTST_bad_domain;
    1.12 +        domain_crash(ld); /* naughty... */
    1.13          return;
    1.14      }
    1.15  
    1.16 @@ -1130,7 +1129,12 @@ gnttab_release_mappings(
    1.17                  handle, ref, map->flags, map->domid);
    1.18  
    1.19          rd = find_domain_by_id(map->domid);
    1.20 -        BUG_ON(rd == NULL);
    1.21 +        if ( rd == NULL )
    1.22 +        {
    1.23 +            /* Nothing to clear up... */
    1.24 +            map->flags = 0;
    1.25 +            continue;
    1.26 +        }
    1.27  
    1.28          spin_lock(&rd->grant_table->lock);
    1.29