From: Greg KH <gregkh@linuxfoundation.org>
To: liulongfang <liulongfang@huawei.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB:bugfix a controller halt error
Date: Fri, 21 Jul 2023 13:08:18 +0200 [thread overview]
Message-ID: <2023072153-module-wannabe-5637@gregkh> (raw)
In-Reply-To: <20230721100015.27124-1-liulongfang@huawei.com>
On Fri, Jul 21, 2023 at 06:00:15PM +0800, liulongfang wrote:
> On systems that use ECC memory. The ECC error of the memory will
> cause the USB controller to halt. It causes the usb_control_msg()
> operation to fail.
Why does ECC memory matter here?
> At this point, the returned buffer data is an abnormal value, and
> continuing to use it will lead to incorrect results.
>
> Therefore, it is necessary to judge the return value and exit.
>
> Signed-off-by: liulongfang <liulongfang@huawei.com>
> ---
> drivers/usb/core/hub.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index a739403a9e45..6a43198be263 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4891,6 +4891,16 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
> USB_DT_DEVICE << 8, 0,
> buf, GET_DESCRIPTOR_BUFSIZE,
> initial_descriptor_timeout);
> + /* On systems that use ECC memory, ECC errors can
> + * cause the USB controller to halt.
> + * It causes this operation to fail. At this time,
> + * the buf data is an abnormal value and needs to be exited.
> + */
> + if (r < 0) {
> + kfree(buf);
> + goto fail;
> + }
Are you sure this is correct? How was this tested? Seems to me that
this will still return "success" if this code path ever happens, what am
I missing?
thanks,
greg k-h
next prev parent reply other threads:[~2023-07-21 11:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 10:00 [PATCH] USB:bugfix a controller halt error liulongfang
2023-07-21 11:08 ` Greg KH [this message]
2023-07-26 6:44 ` liulongfang
2023-07-26 7:18 ` Greg KH
2023-07-26 11:16 ` Oliver Neukum
2023-07-27 7:00 ` liulongfang
2023-07-27 8:46 ` Oliver Neukum
2023-07-27 4:02 ` liulongfang
2023-07-21 14:57 ` Alan Stern
2023-07-24 12:35 ` Oliver Neukum
2023-07-26 6:58 ` liulongfang
2023-07-26 14:20 ` Alan Stern
2023-07-27 7:03 ` liulongfang
2023-07-27 8:47 ` Oliver Neukum
2023-07-27 14:42 ` Alan Stern
2023-07-27 15:31 ` Oliver Neukum
2023-07-27 15:57 ` Alan Stern
2023-08-10 1:20 ` liulongfang
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=2023072153-module-wannabe-5637@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=liulongfang@huawei.com \
/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