netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Wang Yufen <wangyufen@huawei.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>,
	Jiri Pirko <jiri@mellanox.com>
Subject: Re: [PATCH] netdevsim: Fix memory leak of nsim_dev->fa_cookie
Date: Mon, 14 Nov 2022 18:50:28 -0800	[thread overview]
Message-ID: <20221114185028.54fd7e14@kernel.org> (raw)
In-Reply-To: <1668234485-27635-1-git-send-email-wangyufen@huawei.com>

On Sat, 12 Nov 2022 14:28:05 +0800 Wang Yufen wrote:
> nsim_dev_trap_fa_cookie_write()
>   kmalloc() fa_cookie
>   nsim_dev->fa_cookie = fa_cookie
> ..
> nsim_drv_remove()
> 
> nsim_dev->fa_cookie alloced, but the nsim_dev_trap_report_work()
> job has not been done, the flow action cookie has not been assigned
> to the metadata. To fix, add kfree(nsim_dev->fa_cookie) to
> nsim_drv_remove().

I don't see the path thru nsim_dev_trap_report_work() which would free
the fa_cookie.

The fix looks right, but the commit message seems incorrect. Isn't the
leak always there, without any race?

  reply	other threads:[~2022-11-15  2:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12  6:28 [PATCH] netdevsim: Fix memory leak of nsim_dev->fa_cookie Wang Yufen
2022-11-15  2:50 ` Jakub Kicinski [this message]
2022-11-15  3:38   ` wangyufen
2022-11-15  4:48     ` Jakub Kicinski

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=20221114185028.54fd7e14@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wangyufen@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;
as well as URLs for NNTP newsgroup(s).