From: Jan Beulich Date: Fri, 17 Sep 2021 06:13:08 +0000 (+0200) Subject: Xen/gntdev: don't ignore kernel unmapping error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f37fae690d9b315034cdacfa7bda2af6f2d17264;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Xen/gntdev: don't ignore kernel unmapping error commit f28347cc66395e96712f5c2db0a302ee75bafce6 upstream. While working on XSA-361 and its follow-ups, I failed to spot another place where the kernel mapping part of an operation was not treated the same as the user space part. Detect and propagate errors and add a 2nd pr_debug(). Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/c2513395-74dc-aea3-9192-fd265aa44e35@suse.com Signed-off-by: Juergen Gross Signed-off-by: Demi Marie Obenour Co-authored-by: Demi Marie Obenour Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 799173755b78..219376471544 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -399,6 +399,14 @@ static void __unmap_grant_pages_done(int result, map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = -1; + if (use_ptemod) { + WARN_ON(map->kunmap_ops[offset+i].status && + map->kunmap_ops[offset+i].handle != -1); + pr_debug("kunmap handle=%u st=%d\n", + map->kunmap_ops[offset+i].handle, + map->kunmap_ops[offset+i].status); + map->kunmap_ops[offset+i].handle = -1; + } } /* * Decrease the live-grant counter. This must happen after the loop to