Re: [PATCH v2 1/3] rust: core abstractions for network PHY drivers

Greg KH
2023-10-07T11:17:16Z

On Sat, Oct 07, 2023 at 07:58:57PM +0900, FUJITA Tomonori wrote:
> > Since we're taking user input, it probably doesn't hurt to do some
> > sort of sanity check rather than casting. Maybe warn once then return
> > the biggest nowrapping value
> >
> > let speed_i32 = i32::try_from(speed).unwrap_or_else(|_| {
> > warn_once!("excessive speed {speed}");

NEVER call WARN() on user input, as you now just rebooted the machine
and caused a DoS (and syzbot will start to spam you with reports.)

Remember, the majority of Linux systems in the world run with
panic-on-warn enabled, so any user path that can cause this, will be
used to cause problems.

thanks,

greg k-h