netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] usbnet: don't clear urb->dev in tx_complete
@ 2012-03-22 13:22 Ming Lei
  2012-03-22 14:36 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2012-03-22 13:22 UTC (permalink / raw)
  To: David S. Miller, Greg Kroah-Hartman
  Cc: netdev, linux-usb, Ming Lei, stable, Alan Stern, Oliver Neukum

URB unlinking is always racing with its completion and tx_complete
may be called before or during running usb_unlink_urb, so tx_complete
must not clear urb->dev since it will be used in unlink path,
otherwise invalid memory accesses or usb device leak may be caused
inside usb_unlink_urb.

Cc: stable@kernel.org
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/net/usb/usbnet.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index febfdce..62f8b5c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1037,7 +1037,6 @@ static void tx_complete (struct urb *urb)
 	}
 
 	usb_autopm_put_interface_async(dev->intf);
-	urb->dev = NULL;
 	entry->state = tx_done;
 	defer_bh(dev, skb, &dev->txq);
 }
-- 
1.7.9.1

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

* Re: [PATCH 2/2] usbnet: don't clear urb->dev in tx_complete
  2012-03-22 13:22 [PATCH 2/2] usbnet: don't clear urb->dev in tx_complete Ming Lei
@ 2012-03-22 14:36 ` Greg Kroah-Hartman
       [not found]   ` <20120322143607.GD19835-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2012-03-22 14:36 UTC (permalink / raw)
  To: Ming Lei
  Cc: David S. Miller, netdev, linux-usb, stable, Alan Stern,
	Oliver Neukum

On Thu, Mar 22, 2012 at 09:22:38PM +0800, Ming Lei wrote:
> URB unlinking is always racing with its completion and tx_complete
> may be called before or during running usb_unlink_urb, so tx_complete
> must not clear urb->dev since it will be used in unlink path,
> otherwise invalid memory accesses or usb device leak may be caused
> inside usb_unlink_urb.
> 
> Cc: stable@kernel.org
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Oliver Neukum <oliver@neukum.org>
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH 2/2] usbnet: don't clear urb->dev in tx_complete
       [not found]   ` <20120322143607.GD19835-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
@ 2012-03-22 23:33     ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-03-22 23:33 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: tom.leiming-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, stable-DgEjT+Ai2ygdnm+yROfE0A,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	oliver-GvhC2dPhHPQdnm+yROfE0A

From: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Date: Thu, 22 Mar 2012 07:36:07 -0700

> On Thu, Mar 22, 2012 at 09:22:38PM +0800, Ming Lei wrote:
>> URB unlinking is always racing with its completion and tx_complete
>> may be called before or during running usb_unlink_urb, so tx_complete
>> must not clear urb->dev since it will be used in unlink path,
>> otherwise invalid memory accesses or usb device leak may be caused
>> inside usb_unlink_urb.
>> 
>> Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
>> Cc: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
>> Cc: Oliver Neukum <oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
>> Signed-off-by: Ming Lei <tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>

Applied.
--
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] 3+ messages in thread

end of thread, other threads:[~2012-03-22 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 13:22 [PATCH 2/2] usbnet: don't clear urb->dev in tx_complete Ming Lei
2012-03-22 14:36 ` Greg Kroah-Hartman
     [not found]   ` <20120322143607.GD19835-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-03-22 23:33     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).