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] [day] [month] [year] [list]
Date:   Wed, 25 Jul 2018 16:37:51 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Marcus Folkesson <marcus.folkesson@...il.com>
Cc:     Alexey Khoroshilov <khoroshilov@...ras.ru>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] input: pxrc - do not store USB device in private struct

On Tue, Jul 24, 2018 at 08:09:59PM +0200, Marcus Folkesson wrote:
> Hello Dmitry,
> 
> On Tue, Jul 24, 2018 at 02:38:04AM +0000, Dmitry Torokhov wrote:
> > Hi Marcus,
> > 
> > On Mon, Jul 16, 2018 at 04:40:14PM +0200, Marcus Folkesson wrote:
> > > The USB device is only needed during setup, so put it back after
> > > initialization and do not store it in our private struct.
> > > 
> > > Also, the USB device is a parent of USB interface so our driver
> > > model rules ensure that USB device should not disappear while
> > > interface device is still there.
> > > So not keep a refcount on the device is safe.
> > > 
> > > Reported-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> > > Signed-off-by: Marcus Folkesson <marcus.folkesson@...il.com>
> > > ---
> > >  drivers/input/joystick/pxrc.c | 22 ++++++++++++----------
> > >  1 file changed, 12 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
> > > index 07a0dbd3ced2..46a7acb747bf 100644
> > > --- a/drivers/input/joystick/pxrc.c
> > > +++ b/drivers/input/joystick/pxrc.c
> > ...
> > 
> > > @@ -204,23 +204,25 @@ static int pxrc_probe(struct usb_interface *intf,
> > >  		return -ENOMEM;
> > >  
> > >  	mutex_init(&pxrc->pm_mutex);
> > > -	pxrc->udev = usb_get_dev(interface_to_usbdev(intf));
> > > +	udev = usb_get_dev(interface_to_usbdev(intf));
> > 
> > There is really no need to "get" device for the probe duration, or in
> > general, when you are not storing the reference to it.
> > 
> > I posted series with an updated version of this patch plus couple more
> > cleanups/fixes, and would appreciate if you could give it a spin.
> 
> Thank you for doing this.
> 
> I have reviewed the patchset and tested on real hardware, and it looks good
> to me.
> 
> For what it's worth:
> 
> Reviewed-by: Marcus Folkesson <marcus.folkesson@...il.com>
> Tested-by: Marcus Folkesson <marcus.folkesson@...il.com> 
> 
> On the whole patchset.

Excellent, thank you.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ