thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()
authorMario Limonciello <mario.limonciello@dell.com>
Mon, 26 Oct 2020 16:12:59 +0000 (19:12 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Feb 2021 08:29:15 +0000 (09:29 +0100)
commit0e5cb872fbbb32308ef5d71ea595ec42b8d2ac1b
treef0fe5e85d4c39db77a5f6cefa298af064dc9b7e1
parent19155473f3bac244def9f7a7ee609e7f4dbca357
thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()

commit 4d395c5e74398f664405819330e5a298da37f655 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thunderbolt/acpi.c