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 5 lines · Oliver Neukum
Quoted 4 lines · Johan Hovold
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()

Quoted 7 lines
Quoted 4 lines

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")).

Should I? A warning in syslog is pretty hardcore, so I have no idea whether dev_warn() is enough.

Perhaps there are two sides to this. If something really should not be happening and needs to be addressed (i.e. it's a driver bug) that dev_WARN is warranted. If user space can be pass in bogus flags that gets propagated to USB core, perhaps those need to be sanitised sooner (in the vain of "don't trust anything coming from user space").

In general though, I believe dev_warn() is more appropriate for cases where something odd is happening, but we try to recover and proceed anyway (e.g. by sanitising the flags without bailing out as is the case here) instead of aborting.

Johan