diff options
-rw-r--r-- | drivers/usb/gadget/f_eem.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index d61c11d765d0..4d8b236ea608 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
@@ -355,20 +355,18 @@ static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb) | |||
355 | int padlen = 0; | 355 | int padlen = 0; |
356 | u16 len = skb->len; | 356 | u16 len = skb->len; |
357 | 357 | ||
358 | if (!skb_cloned(skb)) { | 358 | int headroom = skb_headroom(skb); |
359 | int headroom = skb_headroom(skb); | 359 | int tailroom = skb_tailroom(skb); |
360 | int tailroom = skb_tailroom(skb); | ||
361 | 360 | ||
362 | /* When (len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) is 0, | 361 | /* When (len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) is 0, |
363 | * stick two bytes of zero-length EEM packet on the end. | 362 | * stick two bytes of zero-length EEM packet on the end. |
364 | */ | 363 | */ |
365 | if (((len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) == 0) | 364 | if (((len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) == 0) |
366 | padlen += 2; | 365 | padlen += 2; |
367 | 366 | ||
368 | if ((tailroom >= (ETH_FCS_LEN + padlen)) && | 367 | if ((tailroom >= (ETH_FCS_LEN + padlen)) && |
369 | (headroom >= EEM_HLEN)) | 368 | (headroom >= EEM_HLEN) && !skb_cloned(skb)) |
370 | goto done; | 369 | goto done; |
371 | } | ||
372 | 370 | ||
373 | skb2 = skb_copy_expand(skb, EEM_HLEN, ETH_FCS_LEN + padlen, GFP_ATOMIC); | 371 | skb2 = skb_copy_expand(skb, EEM_HLEN, ETH_FCS_LEN + padlen, GFP_ATOMIC); |
374 | dev_kfree_skb_any(skb); | 372 | dev_kfree_skb_any(skb); |