memory: fix XENMEM_exchange error handling
authorJan Beulich <jbeulich@suse.com>
Tue, 8 Dec 2015 13:01:43 +0000 (14:01 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 8 Dec 2015 13:01:43 +0000 (14:01 +0100)
commiteedecb3cf0b2ce1ffc2eb08f3c73f88d42c382c9
tree4aa70da79a0606eb260382a890a465ec9aab885c
parent4a578b316eb98975374d88f28904acf13dbcfac2
memory: fix XENMEM_exchange error handling

assign_pages() can fail due to the domain getting killed in parallel,
which should not result in a hypervisor crash.

Reported-by: Julien Grall <julien.grall@citrix.com>
Also delete a redundant put_gfn() - all relevant paths leading to the
"fail" label already do this (and there are also paths where it was
plain wrong). All of the put_gfn()-s got introduced by 51032ca058
("Modify naming of queries into the p2m"), including the otherwise
unneeded initializer for k (with even a kind of misleading comment -
the compiler warning could actually have served as a hint that the use
is wrong).

This is CVE-2015-8339 + CVE-2015-8340 / XSA-159.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/common/memory.c