On Fri, 8 Dec 2017 13:59:09 -0700 Alex Williamson <alex.william...@redhat.com> wrote:
> > > > > > Isn't this all rather racy? I see that we can have multiple > > > callers to register racing. > > I agree, should use a lock here to prevent unregister. For multiple > > caller race, it won't happen since there is only one caller can > > register handler. > > If you have multiple simultaneous callers to > iommu_register_device_fault_handler, they can all get past the test > for fault_param (testing and setting is not atomic), then it's > indeterminate which handler gets installed. Thanks, > I see, having the mutex would prevent it. Later callers would get -EBUSY. Thanks a lot! > Alex