Commit 323ea40f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 0be28863 bb6bccba
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -140,10 +140,14 @@ static struct lock_class_key reserved_rbtree_key;
static inline int match_hid_uid(struct device *dev,
				struct acpihid_map_entry *entry)
{
	struct acpi_device *adev = ACPI_COMPANION(dev);
	const char *hid, *uid;

	hid = acpi_device_hid(ACPI_COMPANION(dev));
	uid = acpi_device_uid(ACPI_COMPANION(dev));
	if (!adev)
		return -ENODEV;

	hid = acpi_device_hid(adev);
	uid = acpi_device_uid(adev);

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