Linux Input/HID development
 help / color / mirror / Atom feed
* [patch]fix race between disconnect and open in usbtouch
@ 2008-06-26 13:32 Oliver Neukum
       [not found] ` <200806261532.06544.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver Neukum @ 2008-06-26 13:32 UTC (permalink / raw)
  To: daniel.ritz, Dmitry Torokhov, Jiri Kosina, linux-usb, linux-input

Hi,

if you kill the URB before you unregister, open can come in between
and resubmit the urb. This patch reverses the order.

	Regards
		Oliver

Signed-off-by: Oliver Neukum <oneukum@suse.de>

---

--- linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c.alt	2008-06-26 15:23:34.000000000 +0200
+++ linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c	2008-06-26 15:23:38.000000000 +0200
@@ -973,8 +973,8 @@ static void usbtouch_disconnect(struct u
 
 	dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
 	usb_set_intfdata(intf, NULL);
-	usb_kill_urb(usbtouch->irq);
 	input_unregister_device(usbtouch->input);
+	usb_kill_urb(usbtouch->irq);
 	usb_free_urb(usbtouch->irq);
 	usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
 	kfree(usbtouch);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
       [not found] ` <200806261532.06544.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
@ 2008-06-26 13:41   ` Ville Syrjälä
       [not found]     ` <20080626134110.GE22310-ORSVBvAovxo@public.gmane.org>
  2008-06-26 14:46     ` Alan Stern
  2008-06-26 17:41   ` Dmitry Torokhov
  1 sibling, 2 replies; 8+ messages in thread
From: Ville Syrjälä @ 2008-06-26 13:41 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: daniel.ritz-OI3hZJvNYWs, Dmitry Torokhov, Jiri Kosina,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA

On Thu, Jun 26, 2008 at 03:32:05PM +0200, Oliver Neukum wrote:
> Hi,
> 
> if you kill the URB before you unregister, open can come in between
> and resubmit the urb. This patch reverses the order.
> 
> 	Regards
> 		Oliver
> 
> Signed-off-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
> 
> ---
> 
> --- linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c.alt	2008-06-26 15:23:34.000000000 +0200
> +++ linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c	2008-06-26 15:23:38.000000000 +0200
> @@ -973,8 +973,8 @@ static void usbtouch_disconnect(struct u
>  
>  	dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
>  	usb_set_intfdata(intf, NULL);
> -	usb_kill_urb(usbtouch->irq);
>  	input_unregister_device(usbtouch->input);
> +	usb_kill_urb(usbtouch->irq);
>  	usb_free_urb(usbtouch->irq);
>  	usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
>  	kfree(usbtouch);

I think you can just remove that usb_kill_urb() call since
usbtouch_close() has already called it by that time.

-- 
Ville Syrjälä
syrjala-ORSVBvAovxo@public.gmane.org
http://www.sci.fi/~syrjala/
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
       [not found]     ` <20080626134110.GE22310-ORSVBvAovxo@public.gmane.org>
@ 2008-06-26 13:49       ` Oliver Neukum
       [not found]         ` <200806261549.28084.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver Neukum @ 2008-06-26 13:49 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: daniel.ritz-OI3hZJvNYWs, Dmitry Torokhov, Jiri Kosina,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA

Am Donnerstag 26 Juni 2008 15:41:10 schrieb Ville Syrjälä:
> > --- linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c.alt        2008-06-26 15:23:34.000000000 +0200
> > +++ linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c    2008-06-26 15:23:38.000000000 +0200
> > @@ -973,8 +973,8 @@ static void usbtouch_disconnect(struct u
> >  
> >       dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
> >       usb_set_intfdata(intf, NULL);
> > -     usb_kill_urb(usbtouch->irq);
> >       input_unregister_device(usbtouch->input);
> > +     usb_kill_urb(usbtouch->irq);
> >       usb_free_urb(usbtouch->irq);
> >       usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
> >       kfree(usbtouch);
> 
> I think you can just remove that usb_kill_urb() call since
> usbtouch_close() has already called it by that time.

Are you sure? Would you prepare a patch?

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
       [not found]         ` <200806261549.28084.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
@ 2008-06-26 14:30           ` Dmitry Torokhov
  2008-06-26 14:35             ` Oliver Neukum
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2008-06-26 14:30 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: Ville Syrjälä, daniel.ritz-OI3hZJvNYWs, Jiri Kosina,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA

On Thu, Jun 26, 2008 at 03:49:26PM +0200, Oliver Neukum wrote:
> Am Donnerstag 26 Juni 2008 15:41:10 schrieb Ville Syrjälä:
> > > --- linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c.alt        2008-06-26 15:23:34.000000000 +0200
> > > +++ linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c    2008-06-26 15:23:38.000000000 +0200
> > > @@ -973,8 +973,8 @@ static void usbtouch_disconnect(struct u
> > >  
> > >       dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
> > >       usb_set_intfdata(intf, NULL);
> > > -     usb_kill_urb(usbtouch->irq);
> > >       input_unregister_device(usbtouch->input);
> > > +     usb_kill_urb(usbtouch->irq);
> > >       usb_free_urb(usbtouch->irq);
> > >       usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
> > >       kfree(usbtouch);
> > 
> > I think you can just remove that usb_kill_urb() call since
> > usbtouch_close() has already called it by that time.
> 
> Are you sure?

Yes, calling dev->close for opened devices as part of unregister is done
by the input core.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
  2008-06-26 14:30           ` Dmitry Torokhov
@ 2008-06-26 14:35             ` Oliver Neukum
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Neukum @ 2008-06-26 14:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Ville Syrjälä, daniel.ritz, Jiri Kosina, linux-usb,
	linux-input

Am Donnerstag 26 Juni 2008 16:30:11 schrieb Dmitry Torokhov:
> > > I think you can just remove that usb_kill_urb() call since
> > > usbtouch_close() has already called it by that time.
> > 
> > Are you sure?
> 
> Yes, calling dev->close for opened devices as part of unregister is done
> by the input core.

OK, thanks.

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
  2008-06-26 13:41   ` Ville Syrjälä
       [not found]     ` <20080626134110.GE22310-ORSVBvAovxo@public.gmane.org>
@ 2008-06-26 14:46     ` Alan Stern
  1 sibling, 0 replies; 8+ messages in thread
From: Alan Stern @ 2008-06-26 14:46 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Oliver Neukum, daniel.ritz, Dmitry Torokhov, Jiri Kosina,
	linux-usb, linux-input

On Thu, 26 Jun 2008, Ville Syrjälä wrote:

> > --- linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c.alt	2008-06-26 15:23:34.000000000 +0200
> > +++ linux-2.6.26-sierra/drivers/input/touchscreen/usbtouchscreen.c	2008-06-26 15:23:38.000000000 +0200
> > @@ -973,8 +973,8 @@ static void usbtouch_disconnect(struct u
> >  
> >  	dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__);
> >  	usb_set_intfdata(intf, NULL);
> > -	usb_kill_urb(usbtouch->irq);
> >  	input_unregister_device(usbtouch->input);
> > +	usb_kill_urb(usbtouch->irq);
> >  	usb_free_urb(usbtouch->irq);
> >  	usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
> >  	kfree(usbtouch);
> 
> I think you can just remove that usb_kill_urb() call since
> usbtouch_close() has already called it by that time.

How do you know that usbtouch_close has been called at this point?

Alan Stern

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
       [not found] ` <200806261532.06544.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
  2008-06-26 13:41   ` Ville Syrjälä
@ 2008-06-26 17:41   ` Dmitry Torokhov
       [not found]     ` <20080626133956.ZZRA012-NG0XCrj25/nJrYCpivWRnl5pS2h4L8biXqFh9Ls21Oc@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2008-06-26 17:41 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: daniel.ritz-OI3hZJvNYWs, Jiri Kosina,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA

On Thu, Jun 26, 2008 at 03:32:05PM +0200, Oliver Neukum wrote:
> Hi,
> 
> if you kill the URB before you unregister, open can come in between
> and resubmit the urb. This patch reverses the order.
> 

Hm, we just talked about it - it should be simply removed, not moved
around.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch]fix race between disconnect and open in usbtouch
       [not found]     ` <20080626133956.ZZRA012-NG0XCrj25/nJrYCpivWRnl5pS2h4L8biXqFh9Ls21Oc@public.gmane.org>
@ 2008-06-26 17:44       ` Dmitry Torokhov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2008-06-26 17:44 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: daniel.ritz-OI3hZJvNYWs, Jiri Kosina,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA

On Thu, Jun 26, 2008 at 01:41:31PM -0400, Dmitry Torokhov wrote:
> On Thu, Jun 26, 2008 at 03:32:05PM +0200, Oliver Neukum wrote:
> > Hi,
> > 
> > if you kill the URB before you unregister, open can come in between
> > and resubmit the urb. This patch reverses the order.
> > 
> 
> Hm, we just talked about it - it should be simply removed, not moved
> around.
> 

Oops, I ma sorry - it looks lke the original mail just now arrived into
my mailbox ;)

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-26 17:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-26 13:32 [patch]fix race between disconnect and open in usbtouch Oliver Neukum
     [not found] ` <200806261532.06544.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-06-26 13:41   ` Ville Syrjälä
     [not found]     ` <20080626134110.GE22310-ORSVBvAovxo@public.gmane.org>
2008-06-26 13:49       ` Oliver Neukum
     [not found]         ` <200806261549.28084.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-06-26 14:30           ` Dmitry Torokhov
2008-06-26 14:35             ` Oliver Neukum
2008-06-26 14:46     ` Alan Stern
2008-06-26 17:41   ` Dmitry Torokhov
     [not found]     ` <20080626133956.ZZRA012-NG0XCrj25/nJrYCpivWRnl5pS2h4L8biXqFh9Ls21Oc@public.gmane.org>
2008-06-26 17:44       ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox