From: Jiale Yao <yaojiale02@163.com>
To: Minas Harutyunyan <hminas@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Youn <johnyoun@synopsys.com>, Felipe Balbi <balbi@ti.com>,
Mian Yousaf Kaukab <yousaf.kaukab@intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 1/4] usb: dwc2: initialize debugfs command buffer
Date: Wed, 21 Oct 2026 18:47:16 +0800 [thread overview]
Message-ID: <20261021104720.4106961-2-yaojiale02@163.com> (raw)
In-Reply-To: <20261021104720.4106961-1-yaojiale02@163.com>
testmode_write() copies user input into an uninitialized stack buffer
and compares fixed command lengths. A short write matching a command
prefix can make strncmp() inspect bytes that were not initialized.
Zero-initialize the buffer so the copied input is always terminated.
Fixes: f91eea447ac3 ("usb: dwc2: move debugfs code to a separate file")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/usb/dwc2/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c
index 3116ac72747f..9fedeb2e3562 100644
--- a/drivers/usb/dwc2/debugfs.c
+++ b/drivers/usb/dwc2/debugfs.c
@@ -31,7 +31,7 @@ static ssize_t testmode_write(struct file *file, const char __user *ubuf, size_t
struct dwc2_hsotg *hsotg = s->private;
unsigned long flags;
u32 testmode = 0;
- char buf[32];
+ char buf[32] = { };
if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
return -EFAULT;
--
2.34.1
next prev parent reply other threads:[~2026-10-21 10:47 UTC|newest]
Thread overview: 7+ 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 ` Jiale Yao [this message]
2026-11-04 1:57 ` [PATCH 1/4] usb: dwc2: initialize debugfs command buffer Thinh Nguyen
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
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=20261021104720.4106961-2-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=hminas@synopsys.com \
--cc=johnyoun@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yousaf.kaukab@intel.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®