From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Andreas Noever <andreas.noever@gmail.com>,
Lukas Wunner <lukas@wunner.de>,
Mario Limonciello <mario.limonciello@dell.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Christian Kellner <christian@kellner.me>,
Len Brown <lenb@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-acpi@vger.kernel.org
Subject: [PATCH 1/6] thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link()
Date: Tue, 26 Jan 2021 18:57:18 +0300 [thread overview]
Message-ID: <20210126155723.9388-2-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20210126155723.9388-1-mika.westerberg@linux.intel.com>
From: Mario Limonciello <mario.limonciello@dell.com>
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>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
--
2.29.2
next prev parent reply other threads:[~2021-01-26 16:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 15:57 [PATCH 0/6] thunderbolt / ACPI: Add support for USB4 _OSC Mika Westerberg
2021-01-26 15:57 ` Mika Westerberg [this message]
2021-01-28 12:36 ` [PATCH 1/6] thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link() Mika Westerberg
2021-01-26 15:57 ` [PATCH 2/6] thunderbolt: Add support for PCIe tunneling disabled (SL5) Mika Westerberg
2021-01-26 16:18 ` Yehezkel Bernat
2021-01-26 16:26 ` Mika Westerberg
2021-01-26 16:29 ` Yehezkel Bernat
2021-01-26 15:57 ` [PATCH 3/6] thunderbolt: Allow disabling XDomain protocol Mika Westerberg
2021-01-26 15:57 ` [PATCH 4/6] ACPI: Execute platform _OSC also with query bit clear Mika Westerberg
2021-01-26 16:25 ` Yehezkel Bernat
2021-01-26 17:21 ` Rafael J. Wysocki
2021-01-26 17:37 ` Limonciello, Mario
2021-01-26 17:42 ` Rafael J. Wysocki
2021-01-26 22:43 ` Limonciello, Mario
2021-01-27 12:49 ` Mika Westerberg
2021-01-27 13:50 ` Rafael J. Wysocki
2021-01-26 15:57 ` [PATCH 5/6] ACPI: Add support for native USB4 control _OSC Mika Westerberg
2021-01-26 17:35 ` Rafael J. Wysocki
2021-01-26 17:46 ` Mika Westerberg
2021-01-26 18:25 ` Rafael J. Wysocki
2021-01-26 18:27 ` Rafael J. Wysocki
2021-01-26 15:57 ` [PATCH 6/6] thunderbolt: Add support for native USB4 _OSC Mika Westerberg
2021-01-26 16:37 ` [PATCH 0/6] thunderbolt / ACPI: Add support for " Yehezkel Bernat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210126155723.9388-2-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=christian@kellner.me \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mario.limonciello@dell.com \
--cc=michael.jamet@intel.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).