lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <10011281644574720@myt5-c7c2e3441f25.qloud-c.yandex.net>
Date:   Fri, 11 Feb 2022 13:18:40 +0300
From:   Aleksandr Fedorov <sanekf@....ru>
To:     Robin Murphy <robin.murphy@....com>
Cc:     Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu: explicitly check for NULL in iommu_dma_get_resv_regions()

> On 2022-02-09 14:09, Aleksandr Fedorov wrote:
>> iommu_dma_get_resv_regions() assumes that iommu_fwspec field for
>> corresponding device is set which is not always true. Since
>> iommu_dma_get_resv_regions() seems to be a future-proof generic API
>> that can be used by any iommu driver, add an explicit check for NULL.
> 
> Except it's not a "generic" interface for drivers to call at random,
> it's a helper for retrieving common firmware-based information
> specifically for drivers already using the fwspec mechanism for common
> firmware bindings. If any driver calls this with a device *without* a
> valid fwnode, it deserves to crash because it's done something
> fundamentally wrong.
> 
> I concur that it's not exactly obvious that "non-IOMMU-specific" means
> "based on common firmware bindings, thus implying fwspec".

Thanks for the explanations, yes, this was the misunderstanding on my
part. Maybe add a comment?

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index d85d54f2b549..ce5e7d4d054a 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -379,6 +379,9 @@ void iommu_put_dma_cookie(struct iommu_domain *domain)
  * for general non-IOMMU-specific reservations. Currently, this covers GICv3
  * ITS region reservation on ACPI based ARM platforms that may require HW MSI
  * reservation.
+ *
+ * Note that this helper is meant to be used only by drivers that are already
+ * using the fwspec mechanism for common firmware bindings.
  */
 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
 {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ