Re: [PATCH v8 13/15] iommu/amd: Use the generic iommu page table

Jason Gunthorpe
2025-12-05T19:46:34Z

On Fri, Dec 05, 2025 at 10:40:49AM +0800, Lai, Yi wrote:
> Hi Alejandro Jimenez,
>
> Greetings!
>
> I used Syzkaller and found that there is WARNING in iommufd_fops_release in linux-next next-20251203.
>
> After bisection and the first bad commit is:
> "
> 789a5913b29c iommu/amd: Use the generic iommu page table
> "

This bisect didn't work out, it is close, but the commit is

e93d5945ed5b ("iommufd: Change the selftest to use iommupt instead of xarray")

It is a refcount leak:

@@ -1215,8 +1215,10 @@ static int iommufd_test_md_check_pa(struct iommufd_ucmd *ucmd,
page_size = 1 << __ffs(mock->domain.pgsize_bitmap);
if (iova % page_size || length % page_size ||
(uintptr_t)uptr % page_size ||
- check_add_overflow((uintptr_t)uptr, (uintptr_t)length, &end))
- return -EINVAL;
+ check_add_overflow((uintptr_t)uptr, (uintptr_t)length, &end)) {
+ rc = -EINVAL;
+ goto out_put;
+ }

I'll send a patch, thanks

Jason