]> git.itanic.dy.fi Git - linux-stable/commit
vfio/type1: fix vaddr_get_pfns() return in vfio_pin_page_external()
authorDaniel Jordan <daniel.m.jordan@oracle.com>
Mon, 8 Mar 2021 17:24:52 +0000 (12:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:10:38 +0000 (11:10 +0200)
commit8c6fd05cf8874e683dfb2749926363faeb3324e0
treeb6c7a586508c0ed2a1c0f33cd5468fb1bf227a4c
parentf31ea57c1183415b7069853a8a57ec9288dc4aef
vfio/type1: fix vaddr_get_pfns() return in vfio_pin_page_external()

commit 4ab4fcfce5b540227d80eb32f1db45ab615f7c92 upstream.

vaddr_get_pfns() now returns the positive number of pfns successfully
gotten instead of zero.  vfio_pin_page_external() might return 1 to
vfio_iommu_type1_pin_pages(), which will treat it as an error, if
vaddr_get_pfns() is successful but vfio_pin_page_external() doesn't
reach vfio_lock_acct().

Fix it up in vfio_pin_page_external().  Found by inspection.

Fixes: be16c1fd99f4 ("vfio/type1: Change success value of vaddr_get_pfn()")
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Message-Id: <20210308172452.38864-1-daniel.m.jordan@oracle.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/vfio_iommu_type1.c