linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Fix get_acpihid_device_id
@ 2020-05-08 22:48 Raul E Rangel
  2020-05-09 11:22 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Raul E Rangel @ 2020-05-08 22:48 UTC (permalink / raw)
  To: Joerg Roedel, Andy Shevchenko, iommu, linux-acpi
  Cc: Daniel Kurtz, dianders, evgreen, Adrian Hunter, Ulf Hansson,
	Raul E Rangel, Jerry Snitselaar, Joerg Roedel, Mika Westerberg,
	Rafael J. Wysocki, linux-kernel

acpi_dev_hid_uid_match expects a null pointer for UID if it doesn't
exist. The acpihid_map_entry contains a char buffer for holding the
UID. If no UID was provided in the IVRS table, this buffer will be
zeroed. If we pass in a null string, acpi_dev_hid_uid_match will return
false because it will try and match an empty string to the ACPI UID of
the device.

Fixes: ae5e6c6439c3 ("iommu/amd: Switch to use acpi_dev_hid_uid_match()")
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
---

 drivers/iommu/amd_iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 20cce366e951..06f603366cb1 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -125,7 +125,8 @@ static inline int get_acpihid_device_id(struct device *dev,
 		return -ENODEV;
 
 	list_for_each_entry(p, &acpihid_map, list) {
-		if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
+		if (acpi_dev_hid_uid_match(adev, p->hid,
+					   p->uid[0] ? p->uid : NULL)) {
 			if (entry)
 				*entry = p;
 			return p->devid;
-- 
2.26.2.645.ge9eca65c58-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-09 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 22:48 [PATCH] iommu/amd: Fix get_acpihid_device_id Raul E Rangel
2020-05-09 11:22 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).