From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Jiale Yao <yaojiale02@163.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 3/4] xhci: debugfs: initialize command buffer
Date: Wed, 21 Oct 2026 15:41:21 +0300 [thread overview]
Message-ID: <24f53405-f73c-48b6-b912-ad1bdd07a498@linux.intel.com> (raw)
In-Reply-To: <20261021104720.4106961-4-yaojiale02@163.com>
On 10/21/26 13:47, Jiale Yao wrote:
> xhci_port_write() copies user input into an uninitialized stack buffer
> and compares ten bytes against the compliance command. A short matching
> prefix can make strncmp() inspect bytes that were not initialized.
>
> Zero-initialize the buffer so the copied input is always terminated.
>
> Fixes: 87a03802184c ("xhci: debugfs: add debugfs interface to enable compliance mode for a port")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
> drivers/usb/host/xhci-debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
> index 2aa01d99f23d..a020cbab9674 100644
> --- a/drivers/usb/host/xhci-debugfs.c
> +++ b/drivers/usb/host/xhci-debugfs.c
> @@ -347,7 +347,7 @@ static ssize_t xhci_port_write(struct file *file, const char __user *ubuf,
> struct seq_file *s = file->private_data;
> struct xhci_port *port = s->private;
> struct xhci_hcd *xhci = hcd_to_xhci(port->rhub->hcd);
> - char buf[32];
> + char buf[32] = { };
> u32 portsc;
> unsigned long flags;
>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
I'll cherry pick this in case Greg doesn't take the whole series
Thanks
Mathias
next prev parent reply other threads:[~2026-10-21 12:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 10:47 [PATCH 0/4] usb: initialize debugfs command buffers Jiale Yao
2026-10-21 10:47 ` [PATCH 1/4] usb: dwc2: initialize debugfs command buffer Jiale Yao
2026-10-21 10:47 ` [PATCH 2/4] usb: gadget: renesas_usb3: " Jiale Yao
2026-10-21 10:47 ` [PATCH 3/4] xhci: debugfs: initialize " Jiale Yao
2026-10-21 12:41 ` Mathias Nyman [this message]
2026-10-21 10:47 ` [PATCH 4/4] usb: mtu3: initialize debugfs " Jiale Yao
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=24f53405-f73c-48b6-b912-ad1bdd07a498@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=stable@vger.kernel.org \
--cc=yaojiale02@163.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
all inboxes | Powered by JetHome®