Skip to content

Commit

Permalink
usbnet: Zero padding byte if there is tail room in skb
Browse files Browse the repository at this point in the history
Usbnet adds a padding byte if a 0 byte USB packet would be sent. Zero
padding byte if there is tail room in skb.

Signed-of-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>

Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Peter Korsgaard authored and Jeff Garzik committed Jul 2, 2007
1 parent 23de559 commit 3e323f3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,11 +953,14 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
/* don't assume the hardware handles USB_ZERO_PACKET
* NOTE: strictly conforming cdc-ether devices should expect
* the ZLP here, but ignore the one-byte packet.
*
* FIXME zero that byte, if it doesn't require a new skb.
*/
if ((length % dev->maxpacket) == 0)
if ((length % dev->maxpacket) == 0) {
urb->transfer_buffer_length++;
if (skb_tailroom(skb)) {
skb->data[skb->len] = 0;
__skb_put(skb, 1);
}
}

spin_lock_irqsave (&dev->txq.lock, flags);

Expand Down

0 comments on commit 3e323f3

Please sign in to comment.