From: Greg KH <gregkh@linuxfoundation.org>
To: Clint George <clintbgeorge@gmail.com>
Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, david.hunter.linux@gmail.com,
linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
khalid@kernel.org
Subject: Re: [PATCH 1/8] usb: gadget: dummy_hcd: replace BUG() with WARN_ON_ONCE()
Date: Wed, 19 Nov 2025 16:27:29 +0100 [thread overview]
Message-ID: <2025111950-early-grumbly-b1e4@gregkh> (raw)
In-Reply-To: <20251119130840.14309-2-clintbgeorge@gmail.com>
On Wed, Nov 19, 2025 at 06:38:33PM +0530, Clint George wrote:
> Replace BUG() with WARN_ON_ONCE() in dummy_validate_stream()
> when stream_id exceeds max_streams. This allows the kernel to
> continue running with a warning instead of crashing.
Nope, you still crashed given that BILLIONS of devices out there have
panic-on-warn enabled :(
>
> Signed-off-by: Clint George <clintbgeorge@gmail.com>
> ---
>
> Testing:
> - The function dummy_validate_stream() was tested using a test module
> that i created where i sent value of urb->stream_id greater than
> max_streams. When using BUG(), the kernel-space used to crash but
> after using WARN_ON_ONCE() the kernel-space does not crash and the
> module terminates gracefully
> - Ensured that the module builds properly
>
> drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 1cefca660..41b7b6907 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -1254,7 +1254,7 @@ static int dummy_validate_stream(struct dummy_hcd *dum_hcd, struct urb *urb)
> if (urb->stream_id > max_streams) {
> dev_err(dummy_dev(dum_hcd), "Stream id %d is out of range.\n",
> urb->stream_id);
> - BUG();
> + WARN_ON_ONCE(1);
If this can actually be hit, PROPERLY HANDLE THE ISSUE!
Don't paper over bugs in the code, handle them correctly. This change
does not do any of that as obviously the author thought that if the
code path got here, the system was so broken it needed to be halted.
Your change could cause it to continue on, in a very vulnerable state
(i.e. broken.)
So I can't take this, sorry. Nor should you want me to take it :)
thanks,
greg k-h
next prev parent reply other threads:[~2025-11-19 15:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 13:08 [PATCH 0/8] usb: gadget: dummy_hcd: coding style improvements and error handling change Clint George
2025-11-19 13:08 ` [PATCH 1/8] usb: gadget: dummy_hcd: replace BUG() with WARN_ON_ONCE() Clint George
2025-11-19 15:27 ` Greg KH [this message]
2025-11-19 13:08 ` [PATCH 2/8] usb: gadget: dummy_hcd: replace symbolic permissions (S_IRUGO) with octal (0444) Clint George
2025-11-19 13:08 ` [PATCH 3/8] usb: gadget: dummy_hcd: use 'unsigned int' instead of bare 'unsigned' Clint George
2025-11-19 13:08 ` [PATCH 4/8] usb: gadget: dummy_hcd: fix block comments, blank lines and function braces Clint George
2025-11-19 15:29 ` Greg KH
2025-11-19 15:36 ` Alan Stern
2025-11-19 13:08 ` [PATCH 5/8] usb: gadget: dummy_hcd: merge multi-line quoted strings into one line Clint George
2025-11-19 13:08 ` [PATCH 6/8] usb: gadget: dummy_hcd: use sizeof(*ptr) instead of sizeof *ptr Clint George
2025-11-19 13:08 ` [PATCH 7/8] usb: gadget: dummy_hcd: remove unnecessary 'else' after return Clint George
2025-11-19 15:25 ` Greg KH
2025-11-19 13:08 ` [PATCH 8/8] usb: gadget: dummy_hcd: fix miscellaneous coding style warnings Clint George
2025-11-27 20:35 ` [PATCH 0/8] usb: gadget: dummy_hcd: coding style improvements and error handling change David Hunter
2025-12-01 20:37 ` [PATCH v2 0/6] usb: gadget: dummy_hcd: coding style improvements Clint George
2025-12-01 20:37 ` [PATCH v2 1/6] usb: gadget: dummy_hcd: replace symbolic permissions (S_IRUGO) with octal (0444) Clint George
2025-12-01 20:37 ` [PATCH v2 2/6] usb: gadget: dummy_hcd: use 'unsigned int' instead of bare 'unsigned' Clint George
2025-12-02 5:29 ` Greg KH
2025-12-01 20:37 ` [PATCH v2 3/6] usb: gadget: dummy_hcd: document ISO endpoint allocation pattern Clint George
2025-12-01 20:37 ` [PATCH v2 4/6] usb: gadget: dummy_hcd: use sizeof(*ptr) instead of sizeof *ptr Clint George
2025-12-01 20:37 ` [PATCH v2 5/6] usb: gadget: dummy_hcd: remove unnecessary parentheses Clint George
2025-12-01 20:37 ` [PATCH v2 6/6] usb: gadget: dummy_hcd: move function braces Clint George
2025-12-02 5:27 ` [PATCH v2 0/6] usb: gadget: dummy_hcd: coding style improvements Greg KH
2025-12-02 15:53 ` Alan Stern
2025-12-02 16:28 ` Robert P. J. Day
2025-12-04 1:01 ` David Hunter
2025-12-04 0:52 ` David Hunter
2025-12-04 0:43 ` David Hunter
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=2025111950-early-grumbly-b1e4@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=clintbgeorge@gmail.com \
--cc=david.hunter.linux@gmail.com \
--cc=khalid@kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stern@rowland.harvard.edu \
/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