mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
net: usb: lan78xx: fix possible skb leak
[ Upstream commit47240ba0cd
] If skb_linearize() fails, we need to free the skb. TSO makes skb bigger, and this bug might be the reason Raspberry Pi 3B+ users had to disable TSO. Fixes:55d7de9de6
("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: RENARD Pierre-Francois <pfrenard@gmail.com> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Woojung Huh <woojung.huh@microchip.com> Cc: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4e30ea665d
commit
72cd84ea52
1 changed files with 3 additions and 6 deletions
|
@ -2724,11 +2724,6 @@ static int lan78xx_stop(struct net_device *net)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lan78xx_linearize(struct sk_buff *skb)
|
||||
{
|
||||
return skb_linearize(skb);
|
||||
}
|
||||
|
||||
static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev,
|
||||
struct sk_buff *skb, gfp_t flags)
|
||||
{
|
||||
|
@ -2740,8 +2735,10 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (lan78xx_linearize(skb) < 0)
|
||||
if (skb_linearize(skb)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue