Skip to content

Commit b39a4d8

Browse files
committed
iommu/amd: Fix NULL dereference bug in match_hid_uid
jira LE-1907 Rebuild_History Non-Buildable kernel-3.10.0-1160.118.1.el7 commit-author Aaron Ma <[email protected]> commit bb6bccb Add a non-NULL check to fix potential NULL pointer dereference Cleanup code to call function once. Signed-off-by: Aaron Ma <[email protected]> Fixes: 2bf9a0a ('iommu/amd: Add iommu support for ACPI HID devices') Signed-off-by: Joerg Roedel <[email protected]> (cherry picked from commit bb6bccb) Signed-off-by: Jonathan Maple <[email protected]>
1 parent d9457d3 commit b39a4d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,14 @@ static struct lock_class_key reserved_rbtree_key;
179179
static inline int match_hid_uid(struct device *dev,
180180
struct acpihid_map_entry *entry)
181181
{
182+
struct acpi_device *adev = ACPI_COMPANION(dev);
182183
const char *hid, *uid;
183184

184-
hid = acpi_device_hid(ACPI_COMPANION(dev));
185-
uid = acpi_device_uid(ACPI_COMPANION(dev));
185+
if (!adev)
186+
return -ENODEV;
187+
188+
hid = acpi_device_hid(adev);
189+
uid = acpi_device_uid(adev);
186190

187191
if (!hid || !(*hid))
188192
return -ENODEV;

0 commit comments

Comments
 (0)