xen/memory: Don't skip the RCU unlock path in acquire_resource()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 22 Sep 2020 13:46:49 +0000 (15:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 13:46:49 +0000 (15:46 +0200)
commit42317dede5be4fe5be27c873f7a3f94d3bba98e0
tree1449db433dbba66696abcedf233820de42a8c062
parente71301ecd50f2d3bd1b960bbf7dcf850d02e7e8a
xen/memory: Don't skip the RCU unlock path in acquire_resource()

In the case that an HVM Stubdomain makes an XENMEM_acquire_resource hypercall,
the FIXME path will bypass rcu_unlock_domain() on the way out of the function.

Move the check to the start of the function.  This does change the behaviour
of the get-size path for HVM Stubdomains, but that functionality is currently
broken and unused anyway, as well as being quite useless to entities which
can't actually map the resource anyway.

This is XSA-334.

Fixes: 83fa6552ce ("common: add a new mappable resource type: XENMEM_resource_grant_table")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/memory.c