Re: [PATCH v3 2/2] usb: typec: ucsi: Implement ChromeOS UCSI driver
From: Pavan Holla
Date: Thu Apr 04 2024 - 16:45:34 EST
On Thu, Apr 4, 2024 at 6:07 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Apr 03, 2024 at 09:58:33PM +0300, Dmitry Baryshkov wrote:
> > I think it's better be written as
> >
> > if (WARN_ON_ONCE(val_len > MAX_EC_DATA_SIZE))
> > return -EINVAL;
>
> So if you trigger this, you just rebooted all boxes that have
> panic-on-warn enabled (hint, the HUGE majority in quantity of Linux
> systems out there.)
>
> So don't do that, just handle it like this.
>
> BUT, if this can be triggered by userspace, do NOT use dev_err() as that
> will just allow userspace to flood the kernel log.
>
> Pavan, who calls this? If userspace, this needs to be fixed. If it's
> only a kernel driver, it's fine as-is.
This code is only called by a kernel driver.
Thanks,
Pavan