Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1713817
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] iommu: Avoid NULL group dereference |
| Date | 2017-08-17 13:00 +0200 |
| Message-ID | <ufqGS-3Hy-1@gated-at.bofh.it> (permalink) |
| References | <ufqxd-3DI-17@gated-at.bofh.it> |
| Organization | ARM Ltd |
On 17/08/17 11:40, Robin Murphy wrote:
> The recently-removed FIXME in iommu_get_domain_for_dev() turns out to
> have been a little misleading, since that check is still worthwhile even
> when groups *are* universal. We have a few IOMMU-aware drivers which
> only care whether their device is already attached to an existing domain
> or not, for which the previous behaviour of iommu_get_domain_for_dev()
> was ideal, and who now crash if their device does not have an IOMMU.
>
> With IOMMU groups now serving as a reliable indicator of whether a
> device has an IOMMU or not (barring false-positives from VFIO no-IOMMU
> mode), drivers could arguably do this:
>
> group = iommu_group_get(dev);
> if (group) {
> domain = iommu_get_domain_for_dev(dev);
> iommu_group_put(group);
> }
>
> However, rather than duplicate that code across multiple callsites,
> particularly when it's still only the domain they care about, let's skip
> straight to the next step and factor out the check into the common place
> it applies - in iommu_get_domain_for_dev() itself. Sure, it ends up
> looking rather familiar, but now it's backed by the reasoning of having
> a robust API able to do the expected thing for all devices regardless.
>
> Fixes: 05f80300dc8b ("iommu: Finish making iommu_group support mandatory")
> Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] iommu: Avoid NULL group dereference Robin Murphy <robin.murphy@arm.com> - 2017-08-17 12:50 +0200
Re: [PATCH] iommu: Avoid NULL group dereference Marc Zyngier <marc.zyngier@arm.com> - 2017-08-17 13:00 +0200
Re: [PATCH] iommu: Avoid NULL group dereference Joerg Roedel <joro@8bytes.org> - 2017-08-17 17:50 +0200
Re: [PATCH] iommu: Avoid NULL group dereference Robin Murphy <robin.murphy@arm.com> - 2017-08-17 19:00 +0200
Re: [PATCH] iommu: Avoid NULL group dereference Joerg Roedel <joro@8bytes.org> - 2017-08-18 11:50 +0200
Re: [PATCH] iommu: Avoid NULL group dereference Shawn Lin <shawn.lin@rock-chips.com> - 2017-08-18 03:00 +0200
csiph-web