lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Jun 2021 11:48:30 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Paul Cercueil <paul@...ndingux.net>
Cc:     周琰杰 <zhouyanjie@...yeetech.com>,
        hminas@...opsys.com, paul@...pouillou.net,
        linux-mips@...r.kernel.org, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, dongsheng.qiu@...enic.com,
        aric.pzqi@...enic.com, sernia.zhou@...mail.com,
        Dragan Čečavac <dragancecavac@...oo.com>
Subject: Re: [PATCH] USB: DWC2: Add VBUS overcurrent detection control.

On Tue, Jun 15, 2021 at 09:52:20AM +0100, Paul Cercueil wrote:
> Hi Zhou,
> 
> Le mar., juin 15 2021 at 16:16:39 +0800, 周琰杰 <zhouyanjie@...yeetech.com>
> a écrit :
> > Hi Greg,
> > 
> > Sorry for taking so long to reply.
> > 
> > 于 Tue, 23 Mar 2021 16:31:29 +0100
> > Greg KH <gregkh@...uxfoundation.org> 写道:
> > 
> > >  On Tue, Mar 23, 2021 at 11:24:26PM +0800, 周琰杰 (Zhou Yanjie)
> > > wrote:
> > >  > Introduce configurable option for enabling GOTGCTL register
> > >  > bits VbvalidOvEn and VbvalidOvVal. Once selected it disables
> > >  > VBUS overcurrent detection.
> > >  >
> > >  > This patch is derived from Dragan Čečavac (in the kernel 3.18
> > >  > tree of CI20). It is very useful for the MIPS Creator CI20(r1).
> > >  > Without this patch, CI20's OTG port has a great probability to
> > >  > face overcurrent warning, which breaks the OTG functionality.
> > >  >
> > >  > Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@...yeetech.com>
> > >  > Signed-off-by: Dragan Čečavac <dragancecavac@...oo.com>
> > >  > ---
> > >  >  drivers/usb/dwc2/Kconfig | 6 ++++++
> > >  >  drivers/usb/dwc2/core.c  | 9 +++++++++
> > >  >  2 files changed, 15 insertions(+)
> > >  >
> > >  > diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> > >  > index c131719..e40d187 100644
> > >  > --- a/drivers/usb/dwc2/Kconfig
> > >  > +++ b/drivers/usb/dwc2/Kconfig
> > >  > @@ -94,4 +94,10 @@ config USB_DWC2_DEBUG_PERIODIC
> > >  >  	  non-periodic transfers, but of course the debug logs
> > >  > will be incomplete. Note that this also disables some debug
> > > messages
> > >  >  	  for which the transfer type cannot be deduced.
> > >  > +
> > >  > +config USB_DWC2_DISABLE_VOD
> > >  > +	bool "Disable VBUS overcurrent detection"
> > >  > +	help
> > >  > +	  Say Y here to switch off VBUS overcurrent detection. It
> > >  > enables USB
> > >  > +	  functionality blocked by overcurrent detection.
> > > 
> > >  Why would this be a configuration option?  Shouldn't this be dynamic
> > >  and just work properly automatically?
> > > 
> > >  You should not have to do this on a build-time basis, it should be
> > >  able to be detected and handled properly at run-time for all
> > > devices.
> > > 
> > 
> > I consulted the original author Dragan Čečavac, he think since this is
> > a feature which disables overcurrent detection, so we are not sure if
> > it could be harmful for some devices. Therefore he advise against
> > enabling it in runtime, and in favor that user explicitely has to
> > enable it.
> 
> This could still be enabled at runtime, though, via a module parameter.
> Leave it enabled by default, and those who want to disable it can do it.

This is not the 1990's, please NEVER add new module parameters,
especially ones that are somehow supposed to be device-specific.

Remember, module options are code-wide, not device-specific.

Just do this based on the device type, or something else dynamic, do NOT
make this be forced to be selected by a kernel configuration option or a
random module option at runtime.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ