Re: [patch]fix memleak in error case of hiddev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Mittwoch, 12. November 2008 15:48:38 schrieb Jiri Kosina:
> On Fri, 31 Oct 2008, Oliver Neukum wrote:
> 
> > > Now, you are right that hiddev_open() doesn't handle error condition from 
> > > usbhid_open(), and that should be fixed. But that doesn't seem to be 
> > > addressed by your patch at all ... ?
> > Very well, this is what I've found in hiddev (with the autosuspend patch).
> > I am porting this to the vanilla and the stable tree.
> > - failure to test for lower range of minors
> > - addition to list before open finishes
> > - failure to handle errors from usbhid_open()
> > - possibility to miss a wakeup in hiddev_read
> > - open() races with hiddev_connect()
> > Note that this is untested and should be tested.
> 
> Does the patch below look OK to you? I have removed the dependency on 
> autosuspend code for now.

No, it doesn't look good.

> +	if (!list->hiddev->open++) {
> +		if (list->hiddev->exist) {

The order of checks is inverted. If the device no longer exists
opening should fail, even if the device is already opened.
Didn't I post a patch that does this? My memory is a bit clouded.

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

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux