[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMtMvYtUrgaM8m7d@kroah.com>
Date: Thu, 17 Jun 2021 15:23:09 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Linyu Yuan <linyyuan@...eaurora.org>
Cc: Oliver Neukum <oliver@...kum.org>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-usb@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: cdc_eem: fix tx fixup skb leak
On Thu, Jun 17, 2021 at 07:32:32AM +0800, Linyu Yuan wrote:
> 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@...eaurora.org>
> ---
>
> v2: add Fixes tag
>
> drivers/net/usb/cdc_eem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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:
> --
> 2.25.1
>
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists