summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/acpi.c
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@dell.com>2020-10-26 19:12:59 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2021-01-28 15:30:57 +0300
commit4d395c5e74398f664405819330e5a298da37f655 (patch)
treee45b2bcca89fff8be148bf659ee4c4b223443225 /drivers/thunderbolt/acpi.c
parent6ee1d745b7c9fd573fba142a2efdad76a9f1cb04 (diff)
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: b2be2b05cf3b ("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>
Diffstat (limited to 'drivers/thunderbolt/acpi.c')
-rw-r--r--drivers/thunderbolt/acpi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index a5f988a9f948..b5442f979b4d 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -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)