Commit 7214c1c8 authored by Jason Gunthorpe's avatar Jason Gunthorpe

iommufd: Add iommufd_lock_obj() around the auto-domains hwpts

A later patch will require this locking - currently under the ioas mutex
the hwpt can not have a 0 reference and be on the list.

Link: https://lore.kernel.org/r/2-v3-ae9c2975a131+2e1e8-iommufd_hwpt_jgg@nvidia.comReviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 085fcc7e
......@@ -282,7 +282,10 @@ static int iommufd_device_auto_get_domain(struct iommufd_device *idev,
if (!hwpt->auto_domain)
continue;
if (!iommufd_lock_obj(&hwpt->obj))
continue;
rc = iommufd_device_do_attach(idev, hwpt);
iommufd_put_object(&hwpt->obj);
/*
* -EINVAL means the domain is incompatible with the device.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment