Commit ea90228c authored by Raul E Rangel's avatar Raul E Rangel Committed by Joerg Roedel

iommu/amd: Fix get_acpihid_device_id()

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: ae5e6c64 ("iommu/amd: Switch to use acpi_dev_hid_uid_match()")
Suggested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarRaul E Rangel <rrangel@chromium.org>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200511103229.v2.1.I6f1b6f973ee6c8af1348611370c73a0ec0ea53f1@changeidSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent e461b8c9
...@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev, ...@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,
return -ENODEV; return -ENODEV;
list_for_each_entry(p, &acpihid_map, list) { 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) if (entry)
*entry = p; *entry = p;
return p->devid; return p->devid;
......
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