Re: [PATCH] fix usb skeleton driver

From: Stefani Seibold
Date: Wed Jun 06 2012 - 08:17:57 EST


Am Mittwoch, den 06.06.2012, 09:32 +0200 schrieb Oliver Neukum:
> 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

Yes, you are right.

But as i now figured out, the whole usb_skeleton.c drivers is full of
races in the skel_open and skel_release path.

I will send a clean and tested patch set in the next few days.

Greetings,
Stefani


--
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/