usbnet: don't clear urb->dev in tx_complete
authortom.leiming@gmail.com <tom.leiming@gmail.com>
Thu, 22 Mar 2012 03:22:38 +0000 (03:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Mar 2012 23:32:34 +0000 (19:32 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/usbnet.c

index febfdceeb9e5d6a7a05132fd411bf161bacf7c41..62f8b5cfbb56c3057f49309d2ad4fbd3d611a309 100644 (file)
@@ -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);
 }