]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
Xen/x86: don't bail early from clear_foreign_p2m_mapping()
authorJan Beulich <jbeulich@suse.com>
Mon, 15 Feb 2021 07:49:34 +0000 (08:49 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 1 Mar 2021 14:56:48 +0000 (15:56 +0100)
commitd51f9a17dca7367c41e99da9bb486f12a448ff06
treec3217140e126f5ca1280e766f87974f54a2829a9
parent06561698804add7db67e059dfce69d0b0690d48f
Xen/x86: don't bail early from clear_foreign_p2m_mapping()

commit a35f2ef3b7376bfd0a57f7844bd7454389aae1fc upstream.

Its sibling (set_foreign_p2m_mapping()) as well as the sibling of its
only caller (gnttab_map_refs()) don't clean up after themselves in case
of error. Higher level callers are expected to do so. However, in order
for that to really clean up any partially set up state, the operation
should not terminate upon encountering an entry in unexpected state. It
is particularly relevant to notice here that set_foreign_p2m_mapping()
would skip setting up a p2m entry if its grant mapping failed, but it
would continue to set up further p2m entries as long as their mappings
succeeded.

Arguably down the road set_foreign_p2m_mapping() may want its page state
related WARN_ON() also converted to an error return.

This is part of XSA-361.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
arch/x86/xen/p2m.c