From: Alexander H Duyck <alexander.duyck@gmail.com>
To: Zhang Changzhong <zhangchangzhong@huawei.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Alexander Duyck <alexander.h.duyck@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] fm10k: fix potential memleak in fm10k_xmit_frame()
Date: Fri, 18 Nov 2022 07:36:03 -0800 [thread overview]
Message-ID: <ea5c55f30cab0a7c8d17f92e2eca2ff5a60f52c3.camel@gmail.com> (raw)
In-Reply-To: <1668775048-22031-1-git-send-email-zhangchangzhong@huawei.com>
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@huawei.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@fb.com>
prev parent reply other threads:[~2022-11-18 15:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 12:37 [PATCH net] fm10k: fix potential memleak in fm10k_xmit_frame() Zhang Changzhong
2022-11-18 15:36 ` Alexander H Duyck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea5c55f30cab0a7c8d17f92e2eca2ff5a60f52c3.camel@gmail.com \
--to=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhangchangzhong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox