Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xen/memory: Make resource_max_frames() to return 0 on unknown type
This is actually what the caller acquire_resource() expects on any kind of error (the comment on top of resource_max_frames() also suggests that). Otherwise, the caller will treat -errno as a valid value and propagate incorrect nr_frames to the VM. As a possible consequence, a VM trying to query a resource size of an unknown type will get the success result from the hypercall and obtain nr_frames 4294967201. Also, add an ASSERT_UNREACHABLE() in the default case of _acquire_resource(), normally we won't get to this point, as an unknown type will always be rejected earlier in resource_max_frames(). Also, update test-resource app to verify that Xen can deal with invalid (unknown) resource type properly. Fixes: 9244528 ("xen/memory: Fix acquire_resource size semantics") Signed-off-by: Oleksandr Tyshchenko <[email protected]> Reviewed-by: Jan Beulich <[email protected]> Reviewed-by: Andrew Cooper <[email protected]> Release-Acked-by: Oleksii Kurochko <[email protected]>
- Loading branch information