Commit 4d395c5e authored by Mario Limonciello's avatar Mario Limonciello Committed by Mika Westerberg

thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()

When we walk up the device hierarchy in tb_acpi_add_link() make sure we
break the loop if the device has no parent. Otherwise we may crash the
kernel by dereferencing a NULL pointer.

Fixes: b2be2b05 ("thunderbolt: Create device links from ACPI description")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMario Limonciello <mario.limonciello@dell.com>
Acked-by: default avatarYehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 6ee1d745
...@@ -56,7 +56,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data, ...@@ -56,7 +56,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
* managed with the xHCI and the SuperSpeed hub so we create the * managed with the xHCI and the SuperSpeed hub so we create the
* link from xHCI instead. * link from xHCI instead.
*/ */
while (!dev_is_pci(dev)) while (dev && !dev_is_pci(dev))
dev = dev->parent; dev = dev->parent;
if (!dev) if (!dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment