[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ea5c55f30cab0a7c8d17f92e2eca2ff5a60f52c3.camel@gmail.com>
Date: Fri, 18 Nov 2022 07:36:03 -0800
From: Alexander H Duyck <alexander.duyck@...il.com>
To: Zhang Changzhong <zhangchangzhong@...wei.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
Alexander Duyck <alexander.h.duyck@...el.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] fm10k: fix potential memleak in fm10k_xmit_frame()
On Fri, 2022-11-18 at 20:37 +0800, Zhang Changzhong wrote:
> The fm10k_xmit_frame() returns NETDEV_TX_OK without freeing skb in error
> handling case, add dev_kfree_skb() to fix it. Compile tested only.
>
> Fixes: b101c9626477 ("fm10k: Add transmit and receive fastpath and interrupt handlers")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
> ---
> drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> index 2cca9e8..c7b672a 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> @@ -531,8 +531,10 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev)
> return NETDEV_TX_OK;
>
> /* make sure there is enough room to move the ethernet header */
> - if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN)))
> + if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN))) {
> + dev_kfree_skb(skb);
> return NETDEV_TX_OK;
> + }
>
> /* verify the skb head is not shared */
> err = skb_cow_head(skb, 0);
Fix looks good to me.
Reviewed-by: Alexander Duyck <alexanderduyck@...com>
Powered by blists - more mailing lists