Skip to content

Commit 323ea40

Browse files
committed
Merge tag 'iommu-fix-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU fix from Joerg Roedel: "Fix a NULL-pointer dereference issue in the ACPI device matching code of the AMD IOMMU driver" * tag 'iommu-fix-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/amd: Fix NULL dereference bug in match_hid_uid
2 parents 0be2886 + bb6bccb commit 323ea40

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
@@ -140,10 +140,14 @@ static struct lock_class_key reserved_rbtree_key;
140140
static inline int match_hid_uid(struct device *dev,
141141
struct acpihid_map_entry *entry)
142142
{
143+
struct acpi_device *adev = ACPI_COMPANION(dev);
143144
const char *hid, *uid;
144145

145-
hid = acpi_device_hid(ACPI_COMPANION(dev));
146-
uid = acpi_device_uid(ACPI_COMPANION(dev));
146+
if (!adev)
147+
return -ENODEV;
148+
149+
hid = acpi_device_hid(adev);
150+
uid = acpi_device_uid(adev);
147151

148152
if (!hid || !(*hid))
149153
return -ENODEV;

0 commit comments

Comments
 (0)