gnttab: don't blindly free status pages upon version change
authorJan Beulich <jbeulich@suse.com>
Tue, 27 Feb 2018 13:07:12 +0000 (14:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 27 Feb 2018 13:07:12 +0000 (14:07 +0100)
commit38bfcc165dda5f4284d7c218b91df9e144ddd88d
treeae5ce4737fd1605db522c85f9549dee2f8fdd9f3
parent9d2f8f9c65d4da35437f50ed9e812a2c5ab313e2
gnttab: don't blindly free status pages upon version change

There may still be active mappings, which would trigger the respective
BUG_ON(). Split the loop into one dealing with the page attributes and
the second (when the first fully passed) freeing the pages. Return an
error if any pages still have pending references.

This is part of XSA-255.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/grant_table.c
xen/include/asm-arm/grant_table.h
xen/include/asm-x86/grant_table.h