* [PATCH] usb: core: usb_submit_urb: downgrade type check
@ 2025-06-11 13:52 Oliver Neukum
2025-06-11 14:12 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2025-06-11 13:52 UTC (permalink / raw)
To: gregKH, linux-usb; +Cc: Oliver Neukum
Checking for the endpoint type is no reason for a WARN,
as that can cause a reboot. A driver not checking the
endpoint type must not cause a reboot, as there is just
no point in this.
We cannot prevent a device from doing something incorrect
as a reaction to a transfer. Hence warning for a mere
assumption being wrong is not sensible.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/core/urb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 5e52a35486af..acf74ad36326 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -500,7 +500,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
/* Check that the pipe's type matches the endpoint's type */
if (usb_pipe_type_check(urb->dev, urb->pipe))
- dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
+ dev_dbg(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
usb_pipetype(urb->pipe), pipetypes[xfertype]);
/* Check against a simple/standard policy */
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: core: usb_submit_urb: downgrade type check
2025-06-11 13:52 [PATCH] usb: core: usb_submit_urb: downgrade type check Oliver Neukum
@ 2025-06-11 14:12 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2025-06-11 14:12 UTC (permalink / raw)
To: Oliver Neukum; +Cc: gregKH, linux-usb
On Wed, Jun 11, 2025 at 03:52:25PM +0200, Oliver Neukum wrote:
> Checking for the endpoint type is no reason for a WARN,
> as that can cause a reboot. A driver not checking the
> endpoint type must not cause a reboot, as there is just
> no point in this.
> We cannot prevent a device from doing something incorrect
> as a reaction to a transfer. Hence warning for a mere
> assumption being wrong is not sensible.
Agreed. On the other hand, we (or at least, I) don't want these
messages to get lost because people haven't enabled dynamic debugging.
And even though we can't change the way the device behaves, we can alter
the kernel's behavior.
How about using dev_warn_once() instead?
Alan Stern
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> drivers/usb/core/urb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
> index 5e52a35486af..acf74ad36326 100644
> --- a/drivers/usb/core/urb.c
> +++ b/drivers/usb/core/urb.c
> @@ -500,7 +500,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
>
> /* Check that the pipe's type matches the endpoint's type */
> if (usb_pipe_type_check(urb->dev, urb->pipe))
> - dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
> + dev_dbg(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
> usb_pipetype(urb->pipe), pipetypes[xfertype]);
>
> /* Check against a simple/standard policy */
> --
> 2.49.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-11 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 13:52 [PATCH] usb: core: usb_submit_urb: downgrade type check Oliver Neukum
2025-06-11 14:12 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox