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:	Thu, 7 Jun 2012 11:27:00 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Stefani Seibold <stefani@...bold.net>
cc:	Greg KH <gregkh@...uxfoundation.org>,
	<linux-kernel@...r.kernel.org>, <oneukum@...e.de>,
	<alan@...rguk.ukuu.org.uk>, <linux-usb@...r.kernel.org>
Subject: Re: [PATCH 04/11] remove usb_interface pointer

On Thu, 7 Jun 2012, Stefani Seibold wrote:

> Am Donnerstag, den 07.06.2012, 10:28 -0400 schrieb Alan Stern:
> > On Thu, 7 Jun 2012, Stefani Seibold wrote:
> > 
> > > I tried to implement your idea to kick away the usb_device pointer, but
> > > i think it is impossible. The skel_delete() function needs the
> > > usb_device pointer for calling usb_put, which is called from
> > > skel_disconnect() or skel_release().
> >   
> > Does skel_delete() really need to call usb_put_dev()?  I suspect that  
> > the driver doesn't need to take a reference to either the device or the
> > interface.
> >  
> 
> I think it will be needed, since usb core will decrement the reference
> when the device go away.

But before it decrements the reference, it will unbind the driver.  As 
long as usb-skeleton is careful not to access the device or the 
interface after the disconnect routine returns, it doesn't need to keep 
a reference.

>  Lock every access to the usb core if a tedious
> thing and will waste a lot of code.

With proper design, it's not necessary to lock every access.

> The problem with hotpluging is not the plug, it is the unplug, which can
> happen any time.
> 
> BTW: An interface have no reference count.

Sure it does.  Look at the definitions of usb_get_intf() and 
usb_put_intf() in drivers/usb/core/usb.c.

> > If skel_delete is changed then we don't need the usb_device pointer.
> > 
> 
> I have no idea how to do this. Every USB driver i know stores the
> usb_device pointer.
> 
> Maybe you have an idea?

No, I was wrong.  It turns out we really do need to keep the udev 
pointer, because it gets used in calls to usb_fill_bulk_urb().  However 
there's nothing wrong with keeping pointers to both the device and the 
interface, if there's a good reason for doing so.

(It also gets used in calls to usb_alloc_coherent(), but I would prefer
to get rid of the coherent buffers.  They are rarely useful and don't
belong here.)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ