ramips: fix cd-poll sd card remove randomly
[openwrt/staging/wigyori.git] / target / linux / generic / patches-4.9 / 023-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
1 From b7c6d2675899cfff0180412c63fc9cbd5bacdb4d Mon Sep 17 00:00:00 2001
2 From: Eric Dumazet <edumazet@google.com>
3 Date: Wed, 19 Apr 2017 09:59:21 -0700
4 Subject: [PATCH] smsc75xx: 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: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
12 Signed-off-by: Eric Dumazet <edumazet@google.com>
13 Cc: James Hughes <james.hughes@raspberrypi.org>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16 drivers/net/usb/smsc75xx.c | 8 ++------
17 1 file changed, 2 insertions(+), 6 deletions(-)
18
19 --- a/drivers/net/usb/smsc75xx.c
20 +++ b/drivers/net/usb/smsc75xx.c
21 @@ -2205,13 +2205,9 @@ static struct sk_buff *smsc75xx_tx_fixup
22 {
23 u32 tx_cmd_a, tx_cmd_b;
24
25 - if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
26 - struct sk_buff *skb2 =
27 - skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
28 + if (skb_cow_head(skb, SMSC75XX_TX_OVERHEAD)) {
29 dev_kfree_skb_any(skb);
30 - skb = skb2;
31 - if (!skb)
32 - return NULL;
33 + return NULL;
34 }
35
36 tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS;