xen/grant-table: add gnttab_try_end_foreign_access()
authorJuergen Gross <jgross@suse.com>
Fri, 25 Feb 2022 15:05:41 +0000 (16:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Mar 2022 11:22:36 +0000 (12:22 +0100)
commit1dd5b4b230f6d1345708c6204ccacdf83d53feaf
tree5507d258158e50d80dd909d3a8fee7871cad252e
parent66cb2bbb522b0d5e4f6a11558ff7bfdf3f7d31f3
xen/grant-table: add gnttab_try_end_foreign_access()

Commit 6b1775f26a2da2b05a6dc8ec2b5d14e9a4701a1a upstream.

Add a new grant table function gnttab_try_end_foreign_access(), which
will remove and free a grant if it is not in use.

Its main use case is to either free a grant if it is no longer in use,
or to take some other action if it is still in use. This other action
can be an error exit, or (e.g. in the case of blkfront persistent grant
feature) some special handling.

This is CVE-2022-23036, CVE-2022-23038 / part of XSA-396.

Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/grant-table.c
include/xen/grant_table.h