diff options
author | Linyu Yuan <linyyuan@codeaurora.org> | 2021-06-17 01:32:32 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-17 20:30:25 +0200 |
commit | c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7 (patch) | |
tree | cf74e5adb2a3d2e3ef625b3b8b7c4be188789128 /drivers/net/usb | |
parent | Merge tag 'mlx5-fixes-2021-06-16' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
download | linux-c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7.tar.xz linux-c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7.zip |
net: cdc_eem: fix tx fixup skb leak
when usbnet transmit a skb, eem fixup it in eem_tx_fixup(),
if skb_copy_expand() failed, it return NULL,
usbnet_start_xmit() will have no chance to free original skb.
fix it by free orginal skb in eem_tx_fixup() first,
then check skb clone status, if failed, return NULL to usbnet.
Fixes: 9f722c0978b0 ("usbnet: CDC EEM support (v5)")
Signed-off-by: Linyu Yuan <linyyuan@codeaurora.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/cdc_eem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 2e60bc1b9a6b..359ea0d10e59 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c @@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, } skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags); + dev_kfree_skb_any(skb); if (!skb2) return NULL; - dev_kfree_skb_any(skb); skb = skb2; done: |