From: Minda Chen <minda.chen@starfivetech.com>
To: Bin Meng <bmeng.cn@gmail.com>, Marek Vasut <marex@denx.de>
Cc: <u-boot@lists.denx.de>, Minda Chen <minda.chen@starfivetech.com>
Subject: [PATCH v1] usb: xhci: Check return value of wait for TRB_TRANSFER event
Date: Tue, 17 Oct 2023 14:20:16 +0800 [thread overview]
Message-ID: <20231017062016.51682-1-minda.chen@starfivetech.com> (raw)
xhci_wait_for_event() waiting TRB_TRANSFER event may return
NULL. Checking the return value to avoid crash.
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
drivers/usb/host/xhci-ring.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c8260cbdf9..5f02ff0769 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -544,6 +544,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
xhci_queue_command(ctrl, 0, udev->slot_id, ep_index, TRB_STOP_RING);
event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+ if (!event)
+ return;
field = le32_to_cpu(event->trans_event.flags);
BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
--
2.17.1
next reply other threads:[~2023-10-17 6:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 6:20 Minda Chen [this message]
2023-10-17 11:20 ` [PATCH v1] usb: xhci: Check return value of wait for TRB_TRANSFER event Marek Vasut
2023-10-18 1:22 ` Minda Chen
2023-10-18 2:35 ` Marek Vasut
2023-10-18 3:46 ` Minda Chen
2023-10-18 10:11 ` Marek Vasut
2023-10-18 10:16 ` Minda Chen
2023-10-18 10:55 ` Marek Vasut
2023-10-19 2:46 ` Minda Chen
2023-10-19 3:22 ` Marek Vasut
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=20231017062016.51682-1-minda.chen@starfivetech.com \
--to=minda.chen@starfivetech.com \
--cc=bmeng.cn@gmail.com \
--cc=marex@denx.de \
--cc=u-boot@lists.denx.de \
/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