]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit708ff4dac782e8fee08ac4a7c65f82e99426206f
tree9d176dcafbd4d520ed292a583406396b85e2389a
parent11d560ddb5f29e33eda7ad2cfaeba74b6825eb15
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: b9c4276bbf07 ("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