Skip to contentSkip to conversation

USB: change dev_WARN to dev_err triggerable from user space

DISCUSSION Johan Hovold 1 participant 1 message Sep 4, 2018 USB

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Oliver Neukum

For those people who run with panic_on_warn a WARN() triggered from user space is a DOS. It is worth returning to dev_err()

I think this should be dev_warn() unless you want to bring back the returning of errors on these conditions as well (i.e. as was the case prior to 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")).

Quoted 2 lines
Fixes 0cb54a3e47cb4baf0bc7463f0a64cfeae5e35697

This should be:

Fixes 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")
Quoted 19 lines
Reported-by [email protected]
---
 drivers/usb/core/urb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/core/urb.c +1 -1
index f51750bcd152..3fe65a774e6c 100644
@@ -475,7 +475,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_urb_ep_type_check(urb))
-		dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
+		dev_err(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
 			usb_pipetype(urb->pipe), pipetypes[xfertype]);
 
 	/* Check against a simple/standard policy */

drivers/usb/core/urb.c int usb_submit_urb(struct urb *urb, gfp_t mem_flags) · line 505

Quoted 8 lines
drivers/usb/core/urb.c +1 -1
@@ -499,7 +499,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 
 	/* warn if submitter gave bogus flags */
 	if (allowed != urb->transfer_flags)
-		dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n",
+		dev_err(&dev->dev, "BOGUS urb flags, %x --> %x\n",
 			urb->transfer_flags, allowed);
 
 	/*

Johan