]> git.baikalelectronics.ru Git - kernel.git/commit
xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE
authorDemi Marie Obenour <demi@invisiblethingslab.com>
Sun, 10 Jul 2022 23:05:22 +0000 (19:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:14:09 +0000 (17:14 +0200)
commitfede7684f2a3deb68c6c748f09d777994f7ff836
treee56670c206808d1b339ad64e4d0f15ec6a88f373
parentc3f99a086b42e5f45756af35324668c2247e7a4a
xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE

commit 058c1a837a78ab233b18b9e19810d72a54c4db87 upstream.

The error paths of gntdev_mmap() can call unmap_grant_pages() even
though not all of the pages have been successfully mapped.  This will
trigger the WARN_ON()s in __unmap_grant_pages_done().  The number of
warnings can be very large; I have observed thousands of lines of
warnings in the systemd journal.

Avoid this problem by only warning on unmapping failure if the handle
being unmapped is not INVALID_GRANT_HANDLE.  The handle field of any
page that was not successfully mapped will be INVALID_GRANT_HANDLE, so
this catches all cases where unmapping can legitimately fail.

Fixes: 455f56df725c ("xen/gntdev: Avoid blocking in unmap_grant_pages()")
Cc: stable@vger.kernel.org
Suggested-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220710230522.1563-1-demi@invisiblethingslab.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/gntdev.c