Skip to contentSkip to conversation

usbnet: don't clear urb->dev in tx_complete

PATCH In review Ming Lei 3 participants 3 messages Mar 22, 2012 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 2/2 usbnet: don't clear urb->dev in tx_complete

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.

---
 drivers/net/usb/usbnet.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/usb/usbnet.c +0 -1
index febfdce..62f8b5c 100644
@@ -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);
 }
Signature · 1 line
1.7.9.1
Acked-by on v1 2/2
#1 lore raw
Quoted 10 lines · Ming Lei

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.

#3 lore raw
In reply to a message not in the archive

From: Greg Kroah-Hartman <[email protected]>
Date: Thu, 22 Mar 2012 07:36:07 -0700

Quoted 7 lines · Ming Lei
Quoted 6 lines

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.

Quoted 6 lines
Quoted 4 lines
Cc Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>
Cc Oliver Neukum <[email protected]>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html