* [PATCH AUTOSEL 5.13 58/88] vfio/type1: Fix vfio_find_dma_valid return
[not found] <20210910001820.174272-1-sashal@kernel.org>
@ 2021-09-10 0:17 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2021-09-10 0:17 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Anthony Yznaga, Steve Sistare, Alex Williamson, Sasha Levin, kvm
From: Anthony Yznaga <anthony.yznaga@oracle.com>
[ Upstream commit ffc95d1b8edb80d2dab77f2e8a823c8d93b06419 ]
vfio_find_dma_valid is defined to return WAITED on success if it was
necessary to wait. However, the loop forgets the WAITED value returned
by vfio_wait() and returns 0 in a later iteration. Fix it.
Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>
Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
Link: https://lore.kernel.org/r/1629736550-2388-1-git-send-email-anthony.yznaga@oracle.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vfio/vfio_iommu_type1.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index a3e925a41b0d..98dd65bf8fe7 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -611,17 +611,17 @@ static int vfio_wait(struct vfio_iommu *iommu)
static int vfio_find_dma_valid(struct vfio_iommu *iommu, dma_addr_t start,
size_t size, struct vfio_dma **dma_p)
{
- int ret;
+ int ret = 0;
do {
*dma_p = vfio_find_dma(iommu, start, size);
if (!*dma_p)
- ret = -EINVAL;
+ return -EINVAL;
else if (!(*dma_p)->vaddr_invalid)
- ret = 0;
+ return ret;
else
ret = vfio_wait(iommu);
- } while (ret > 0);
+ } while (ret == WAITED);
return ret;
}
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-10 0:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210910001820.174272-1-sashal@kernel.org>
2021-09-10 0:17 ` [PATCH AUTOSEL 5.13 58/88] vfio/type1: Fix vfio_find_dma_valid return Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).