On Tue, Oct 25, 2022 at 03:12:18PM -0300, Jason Gunthorpe wrote: > +int iopt_unmap_all(struct io_pagetable *iopt, unsigned long *unmapped) > +{ > + return iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped); > +} syzkaller indirectly noticed that unmap all of an empty IOAS returns ENOENT, it makes more sense it should succeed: - return iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped); + int rc; + + rc = iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped); + /* If the IOVAs are empty then unmap all succeeds */ + if (rc == -ENOENT) + return 0; + return rc; Plus a selftest to cover it Jason