Re: [PATCH] fix usb skeleton driver

From: Oliver Neukum
Date: Wed Jun 06 2012 - 03:35:25 EST


Am Mittwoch, 6. Juni 2012, 09:00:36 schrieb stefani@xxxxxxxxxxx:
> @@ -126,32 +122,21 @@ exit:
>
> static int skel_release(struct inode *inode, struct file *file)
> {
> - struct usb_skel *dev;
> -
> - dev = file->private_data;
> - if (dev == NULL)
> - return -ENODEV;
> + struct usb_skel *dev = file->private_data;
>
> /* allow the device to be autosuspended */
> - mutex_lock(&dev->io_mutex);
> - if (dev->interface)
> - usb_autopm_put_interface(dev->interface);
> - mutex_unlock(&dev->io_mutex);
> + usb_autopm_put_interface(dev->interface);

That is a bug. You must check for disconnect here, because
after a disconnect the interface may be bound already to another
driver.

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