Skip to content

Commit

Permalink
thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()
Browse files Browse the repository at this point in the history
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: b2be2b0 ("thunderbolt: Create device links from ACPI description")
Cc: stable@vger.kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  • Loading branch information
Mario Limonciello authored and Mika Westerberg committed Jan 28, 2021
1 parent 6ee1d74 commit 4d395c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thunderbolt/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* link from xHCI instead.
*/
while (!dev_is_pci(dev))
while (dev && !dev_is_pci(dev))
dev = dev->parent;

if (!dev)
Expand Down

0 comments on commit 4d395c5

Please sign in to comment.