]> err.no Git - linux-2.6/commitdiff
usbnet: Zero padding byte if there is tail room in skb
authorPeter Korsgaard <jacmet@sunsite.dk>
Wed, 27 Jun 2007 06:48:15 +0000 (08:48 +0200)
committerJeff Garzik <jeff@garzik.org>
Mon, 2 Jul 2007 12:24:51 +0000 (08:24 -0400)
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>
drivers/net/usb/usbnet.c

index 5b16d9a1269a2851e3f8982b23f835c256044ba7..a12f576391cf3150d2716b040e6bc06d1eb93844 100644 (file)
@@ -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);