diff options
author | Yan Zhao <[email protected]> | 2023-07-28 18:35:10 -0700 |
---|---|---|
committer | Paolo Bonzini <[email protected]> | 2023-08-31 13:48:53 -0400 |
commit | a15e61f3371b35b7db2d7890fdc68e5f7678e49f (patch) | |
tree | 5243fed2841cbdb969943208e4d05652dc9cc5e1 | |
parent | adc7b226b7d675d011fe86447a5a36b932f1b061 (diff) |
drm/i915/gvt: Don't try to unpin an empty page range
Attempt to unpin pages in the error path of gvt_pin_guest_page() if and
only if at least one page was successfully pinned. Unpinning doesn't
cause functional problems, but vfio_device_container_unpin_pages()
rightfully warns about being asked to unpin zero pages.
Signed-off-by: Yan Zhao <[email protected]>
[sean: write changelog]
Reviewed-by: Zhi Wang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
-rw-r--r-- | drivers/gpu/drm/i915/gvt/kvmgt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 429f0f993a13..0366a699baf5 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -172,7 +172,8 @@ static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, *page = base_page; return 0; err: - gvt_unpin_guest_page(vgpu, gfn, npage * PAGE_SIZE); + if (npage) + gvt_unpin_guest_page(vgpu, gfn, npage * PAGE_SIZE); return ret; } |