From: Peter Korsgaard Date: Wed, 27 Jun 2007 06:48:15 +0000 (+0200) Subject: usbnet: Zero padding byte if there is tail room in skb X-Git-Tag: v2.6.22~47^2~8 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e323f3e86196eec18d6959585aa3188d060c43b;p=linux-2.6 usbnet: Zero padding byte if there is tail room in skb 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 Acked-by: David Brownell Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 5b16d9a126..a12f576391 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -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);