VMCI: check return value of get_user_pages_fast() for errors
authorAlex Dewar <alex.dewar90@gmail.com>
Tue, 25 Aug 2020 16:45:18 +0000 (17:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Aug 2020 10:31:39 +0000 (12:31 +0200)
commit90ca6333fd65f318c47bff425e1ea36c0a5539f6
tree9d176dcafbd4d520ed292a583406396b85e2389a
parentda0d6b3a536bc800cb46b35cc75327fd546b6272
VMCI: check return value of get_user_pages_fast() for errors

In a couple of places in qp_host_get_user_memory(),
get_user_pages_fast() is called without properly checking for errors. If
e.g. -EFAULT is returned, this negative value will then be passed on to
qp_release_pages(), which expects a u64 as input.

Fix this by only calling qp_release_pages() when we have a positive
number returned.

Fixes: 06164d2b72aa ("VMCI: queue pairs implementation.")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Link: https://lore.kernel.org/r/20200825164522.412392-1-alex.dewar90@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_queue_pair.c