Re: [PATCH v3 04/11] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 09, 2024 at 09:38:04AM -0700, Nicolin Chen wrote:

> +int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)
[...]
> +       if (cmd->type == IOMMU_VIOMMU_TYPE_DEFAULT) {
> +               viommu = __iommufd_viommu_alloc(ucmd->ictx, sizeof(*viommu),
> +                                               NULL);
> +       } else {
> +               if (!ops->viommu_alloc) {
> +                       rc = -EOPNOTSUPP;
> +                       goto out_put_hwpt;
> +               }
> +
> +               viommu = ops->viommu_alloc(idev->dev->iommu->iommu_dev,
> +                                          hwpt_paging->common.domain,
> +                                          ucmd->ictx, cmd->type);
> +       }
> +       if (IS_ERR(viommu)) {
> +               rc = PTR_ERR(viommu);
> +               goto out_put_hwpt;
> +       }

While reworking the vIRQ series, I found here we should verify
this driver-allocated viommu object if it is allocated properly
via the suggested API (or if it is properly init-ed as a legit
ictx object).

Likely it needs a helper doing a comparison between viommu->obj
and the returned obj of xa_load(&ictx->objects, viommu->obj.id).
And the following vDEVICE alloc needs it too.

Nicolin




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux