diff options
author | James Hughes <james.hughes@raspberrypi.org> | 2017-04-19 06:13:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-20 16:27:15 -0400 |
commit | e9156cd26a495a18706e796f02a81fee41ec14f4 (patch) | |
tree | 1611a0f290429a70e0fbbecada5a825f2af0e324 | |
parent | 74d209b8350a19d4f70252aa7a4e3d0b865676dd (diff) |
smsc95xx: Use skb_cow_head to deal with cloned skbs
The driver was failing to check that the SKB wasn't cloned
before adding checksum data.
Replace existing handling to extend/copy the header buffer
with skb_cow_head.
Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Woojung Huh <Woojung.Huh@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 831aa33d078a..5f19fb0f025d 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -2001,13 +2001,13 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev, | |||
2001 | /* We do not advertise SG, so skbs should be already linearized */ | 2001 | /* We do not advertise SG, so skbs should be already linearized */ |
2002 | BUG_ON(skb_shinfo(skb)->nr_frags); | 2002 | BUG_ON(skb_shinfo(skb)->nr_frags); |
2003 | 2003 | ||
2004 | if (skb_headroom(skb) < overhead) { | 2004 | /* Make writable and expand header space by overhead if required */ |
2005 | struct sk_buff *skb2 = skb_copy_expand(skb, | 2005 | if (skb_cow_head(skb, overhead)) { |
2006 | overhead, 0, flags); | 2006 | /* Must deallocate here as returning NULL to indicate error |
2007 | * means the skb won't be deallocated in the caller. | ||
2008 | */ | ||
2007 | dev_kfree_skb_any(skb); | 2009 | dev_kfree_skb_any(skb); |
2008 | skb = skb2; | 2010 | return NULL; |
2009 | if (!skb) | ||
2010 | return NULL; | ||
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | if (csum) { | 2013 | if (csum) { |