Skip to content

Commit 0e5cb87

Browse files
Mario Limonciellogregkh
authored andcommitted
thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()
commit 4d395c5 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: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1915547 commit 0e5cb87

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/thunderbolt/acpi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
5656
* managed with the xHCI and the SuperSpeed hub so we create the
5757
* link from xHCI instead.
5858
*/
59-
while (!dev_is_pci(dev))
59+
while (dev && !dev_is_pci(dev))
6060
dev = dev->parent;
6161

6262
if (!dev)

0 commit comments

Comments
 (0)