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:	Fri, 8 Jun 2012 09:46:03 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Stefani Seibold <stefani@...bold.net>
cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Greg KH <gregkh@...uxfoundation.org>, <oneukum@...e.de>,
	<alan@...rguk.ukuu.org.uk>, <linux-usb@...r.kernel.org>
Subject: Re: RFC: remove usb_device pointer from usb_skeleton.c

On Fri, 8 Jun 2012, Stefani Seibold wrote:

> Hi,
> 
> what do you think about this solution for removing the usb_device
> pointer from the struct usb_skel in the usb_skeleton driver?

There's nothing wrong with keeping the pointer there.  Why do you want 
to remove it?

> @@ -73,9 +73,12 @@ static struct usb_driver skel_driver;
>  static void skel_delete(struct kref *kref)
>  {
>  	struct usb_skel *dev = to_skel_dev(kref);
> +	struct usb_interface *interface = dev->interface;
> +	struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
>  
>  	usb_free_urb(dev->bulk_in_urb);
> -	usb_put_dev(dev->udev);
> +	usb_put_dev(udev);

On the other hand, this usb_put_dev call is useless.  Why do you want 
to keep it?

> +	usb_put_intf(interface);

If you get rid of the usb_put_dev then this call is also useless.

>  	kfree(dev->bulk_in_buffer);
>  	kfree(dev);
>  }
> @@ -128,7 +131,7 @@ static int skel_release(struct inode *inode, struct file *file)
>  
>  	/* allow the device to be autosuspended */
>  	mutex_lock(&dev->io_mutex);
> -	if (dev->interface)
> +	if (dev->connected)

There's nothing really wrong with adding a "disconnected" flag.  But 
setting dev->interface to NULL works just as well, in my opinion.  It's 
a matter of taste.

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