]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iommu/amd: Fix get_acpihid_device_id()
authorRaul E Rangel <rrangel@chromium.org>
Mon, 11 May 2020 16:33:36 +0000 (10:33 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 15:48:02 +0000 (17:48 +0200)
[ Upstream commit ea90228c7b2ae6646bb6381385229aabb6f14cd2 ]

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()")
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200511103229.v2.1.I6f1b6f973ee6c8af1348611370c73a0ec0ea53f1@changeid
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd_iommu.c

index 500d0a8c966fc56b08c54fb359b04b4fd821f04a..1d8634250afc63d39660eebb707ea4497dc77c27 100644 (file)
@@ -127,7 +127,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;