Skip to content

Commit ea90228

Browse files
Raul E Rangeljoergroedel
authored andcommitted
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: ae5e6c6 ("iommu/amd: Switch to use acpi_dev_hid_uid_match()") Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Raul E Rangel <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/20200511103229.v2.1.I6f1b6f973ee6c8af1348611370c73a0ec0ea53f1@changeid Signed-off-by: Joerg Roedel <[email protected]>
1 parent e461b8c commit ea90228

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,
127127
return -ENODEV;
128128

129129
list_for_each_entry(p, &acpihid_map, list) {
130-
if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
130+
if (acpi_dev_hid_uid_match(adev, p->hid,
131+
p->uid[0] ? p->uid : NULL)) {
131132
if (entry)
132133
*entry = p;
133134
return p->devid;

0 commit comments

Comments
 (0)