]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/type1: fix dirty bitmap calculation in vfio_dma_rw
authorYan Zhao <yan.y.zhao@intel.com>
Wed, 16 Sep 2020 02:30:05 +0000 (10:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:05 +0000 (10:08 +0100)
commited4ce310b712773e35d5743ddc09adb54ee63e69
tree4cea41d91c5354de856d7fd415049b67652f0468
parent01bec5d78c05b1fb2e8b1141a7bfd9f9b7f1ad3c
vfio/type1: fix dirty bitmap calculation in vfio_dma_rw

[ Upstream commit 2c5af98592f65517170c7bcc714566590d3f7397 ]

The count of dirtied pages is not only determined by count of copied
pages, but also by the start offset.

e.g. if offset = PAGE_SIZE - 1, and *copied=2, the dirty pages count
is 2, instead of 1 or 0.

Fixes: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking")
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/vfio_iommu_type1.c