[PATCH] usbnet: Zero padding byte if there is tail room in skb

STALE6972d REVIEWED: 1 (0M)

1 review trailer.

2 messages, 2 authors, 2007-07-02 · open the first message on its own page

[PATCH] usbnet: Zero padding byte if there is tail room in skb

From: Peter Korsgaard <jacmet@sunsite.dk>
Date: 2007-06-27 06:47:57

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 [off-list ref]
Acked-by: David Brownell <redacted>

---
 drivers/net/usb/usbnet.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: linux-2.6.22-rc6/drivers/net/usb/usbnet.c
===================================================================
--- linux-2.6.22-rc6.orig/drivers/net/usb/usbnet.c
+++ linux-2.6.22-rc6/drivers/net/usb/usbnet.c
@@ -953,11 +953,14 @@
 	/* 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);
-- 
Bye, Peter Korsgaard

Re: [PATCH] usbnet: Zero padding byte if there is tail room in skb

From: Jeff Garzik <hidden>
Date: 2007-07-02 12:25:28

Peter Korsgaard wrote:
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 [off-list ref]
Acked-by: David Brownell <redacted>

---
 drivers/net/usb/usbnet.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
applied

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help