usbnet.c (3d04d42312eacc68fbcddea337f7eb34bc035dfb) | usbnet.c (0956a8c20b23d429e79ff86d4325583fc06f9eb4) |
---|---|
1/* 2 * USB Network driver infrastructure 3 * Copyright (C) 2000-2005 by David Brownell 4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 575 unchanged lines hidden (view full) --- 584 skb_queue_walk_safe(q, skb, skbnext) { 585 struct skb_data *entry; 586 struct urb *urb; 587 int retval; 588 589 entry = (struct skb_data *) skb->cb; 590 urb = entry->urb; 591 | 1/* 2 * USB Network driver infrastructure 3 * Copyright (C) 2000-2005 by David Brownell 4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 575 unchanged lines hidden (view full) --- 584 skb_queue_walk_safe(q, skb, skbnext) { 585 struct skb_data *entry; 586 struct urb *urb; 587 int retval; 588 589 entry = (struct skb_data *) skb->cb; 590 urb = entry->urb; 591 |
592 /* 593 * Get reference count of the URB to avoid it to be 594 * freed during usb_unlink_urb, which may trigger 595 * use-after-free problem inside usb_unlink_urb since 596 * usb_unlink_urb is always racing with .complete 597 * handler(include defer_bh). 598 */ 599 usb_get_urb(urb); |
|
592 spin_unlock_irqrestore(&q->lock, flags); 593 // during some PM-driven resume scenarios, 594 // these (async) unlinks complete immediately 595 retval = usb_unlink_urb (urb); 596 if (retval != -EINPROGRESS && retval != 0) 597 netdev_dbg(dev->net, "unlink urb err, %d\n", retval); 598 else 599 count++; | 600 spin_unlock_irqrestore(&q->lock, flags); 601 // during some PM-driven resume scenarios, 602 // these (async) unlinks complete immediately 603 retval = usb_unlink_urb (urb); 604 if (retval != -EINPROGRESS && retval != 0) 605 netdev_dbg(dev->net, "unlink urb err, %d\n", retval); 606 else 607 count++; |
608 usb_put_urb(urb); |
|
600 spin_lock_irqsave(&q->lock, flags); 601 } 602 spin_unlock_irqrestore (&q->lock, flags); 603 return count; 604} 605 606// Flush all pending rx urbs 607// minidrivers may need to do this when the MTU changes --- 960 unchanged lines hidden --- | 609 spin_lock_irqsave(&q->lock, flags); 610 } 611 spin_unlock_irqrestore (&q->lock, flags); 612 return count; 613} 614 615// Flush all pending rx urbs 616// minidrivers may need to do this when the MTU changes --- 960 unchanged lines hidden --- |