xen/gntalloc: fix oops after runnning out of grant refs
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 2 Sep 2014 14:21:29 +0000 (15:21 +0100)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 4 Sep 2014 12:13:13 +0000 (13:13 +0100)
commite9de2e5fd602c4f5ddf212d3837b19ad4f5878ad
tree5de52049ae43fe91f89196a76c23c24fc32e554e
parent3dcf63677d4eb7fdfc13290c8558c301d2588fe8
xen/gntalloc: fix oops after runnning out of grant refs

Only set gref->gref_id if foreign access was successfully granted and
the grant ref is valid.

If gref->gref_id == -ENOSPC the test in __del_gref() would incorrectly
attempt to end foreign access (because grant_ref_t is unsigned).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reported-by: Dave Scott <dave.scott@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/gntalloc.c