intel-iommu: Fix integer overflow in dma_pte_{clear_range,free_pagetable}()
If end_pfn is equal to (unsigned long)-1, then the loop will never end. Seen on 32-bit kernel, but could have happened on 64-bit too once we get hardware that supports 64-bit guest addresses. Change both functions to a 'do {} while' loop with the test at the end, and check for the PFN having wrapper round to zero. Reported-by: NBenjamin LaHaise <ben.lahaise@neterion.com> Tested-by: NBenjamin LaHaise <ben.lahaise@neterion.com> Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
Showing
想要评论请 注册 或 登录