]> Gentwo Git Trees - linux/.git/commit
iommufd: Don't overflow during division for dirty tracking
authorJason Gunthorpe <jgg@nvidia.com>
Wed, 8 Oct 2025 18:17:18 +0000 (15:17 -0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 20 Oct 2025 22:58:37 +0000 (19:58 -0300)
commitcb30dfa75d55eced379a42fd67bd5fb7ec38555e
tree9ade4052f6c06adce026341e2ca908cf9f8e5843
parent211ddde0823f1442e4ad052a2f30f050145ccada
iommufd: Don't overflow during division for dirty tracking

If pgshift is 63 then BITS_PER_TYPE(*bitmap->bitmap) * pgsize will overflow
to 0 and this triggers divide by 0.

In this case the index should just be 0, so reorganize things to divide
by shift and avoid hitting any overflows.

Link: https://patch.msgid.link/r/0-v1-663679b57226+172-iommufd_dirty_div0_jgg@nvidia.com
Cc: stable@vger.kernel.org
Fixes: 58ccf0190d19 ("vfio: Add an IOVA bitmap support")
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reported-by: syzbot+093a8a8b859472e6c257@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=093a8a8b859472e6c257
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/iova_bitmap.c