ar71xx: keep the RouterBOARD Power LED in On state
[oweals/openwrt.git] / target / linux / generic / patches-4.9 / 023-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
1 From d4ca73591916b760478d2b04334d5dcadc028e9c Mon Sep 17 00:00:00 2001
2 From: Eric Dumazet <edumazet@google.com>
3 Date: Wed, 19 Apr 2017 09:59:24 -0700
4 Subject: [PATCH] lan78xx: use skb_cow_head() to deal with cloned skbs
5
6 We need to ensure there is enough headroom to push extra header,
7 but we also need to check if we are allowed to change headers.
8
9 skb_cow_head() is the proper helper to deal with this.
10
11 Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
12 Signed-off-by: Eric Dumazet <edumazet@google.com>
13 Cc: James Hughes <james.hughes@raspberrypi.org>
14 Cc: Woojung Huh <woojung.huh@microchip.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17  drivers/net/usb/lan78xx.c | 9 ++-------
18  1 file changed, 2 insertions(+), 7 deletions(-)
19
20 --- a/drivers/net/usb/lan78xx.c
21 +++ b/drivers/net/usb/lan78xx.c
22 @@ -2419,14 +2419,9 @@ static struct sk_buff *lan78xx_tx_prep(s
23  {
24         u32 tx_cmd_a, tx_cmd_b;
25  
26 -       if (skb_headroom(skb) < TX_OVERHEAD) {
27 -               struct sk_buff *skb2;
28 -
29 -               skb2 = skb_copy_expand(skb, TX_OVERHEAD, 0, flags);
30 +       if (skb_cow_head(skb, TX_OVERHEAD)) {
31                 dev_kfree_skb_any(skb);
32 -               skb = skb2;
33 -               if (!skb)
34 -                       return NULL;
35 +               return NULL;
36         }
37  
38         if (lan78xx_linearize(skb) < 0)