Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: keitasuzuki.park@sslab.ics.keio.ac.jp
Cc: takafumi.kubota1012@sslab.ics.keio.ac.jp, kuba@kernel.org,
	oss-drivers@netronome.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfp: Fix memory leak in nfp_resource_acquire()
Date: Thu, 09 Apr 2020 10:18:44 -0700 (PDT)	[thread overview]
Message-ID: <20200409.101844.1655988786538703860.davem@davemloft.net> (raw)
In-Reply-To: <20200409150210.15488-1-keitasuzuki.park@sslab.ics.keio.ac.jp>

From: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Date: Thu,  9 Apr 2020 15:02:07 +0000

> This patch fixes a memory leak in nfp_resource_acquire(). res->mutex is
> alllocated in nfp_resource_try_acquire(). However, when
> msleep_interruptible() or time_is_before_eq_jiffies() fails, it falls
> into err_fails path where res is freed, but res->mutex is not.
> 
> Fix this by changing call to free to nfp_resource_release().
> 
> Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>

Did you test compile this?

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c: In function ‘nfp_resource_acquire’:
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c:203:2: error: implicit declaration of function ‘nfp_resource_relase’; did you mean ‘nfp_resource_release’? [-Werror=implicit-function-declaration]
  nfp_resource_relase(res);
  ^~~~~~~~~~~~~~~~~~~
  nfp_resource_release

And this makes me feel like the test was not runtime tested either.

  reply	other threads:[~2020-04-09 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 15:02 [PATCH] nfp: Fix memory leak in nfp_resource_acquire() Keita Suzuki
2020-04-09 17:18 ` David Miller [this message]
2020-04-09 17:38   ` Keita Suzuki
2020-04-09 17:41 ` Keita Suzuki
2020-04-09 19:32   ` Jakub Kicinski
2020-04-10  5:21     ` Keita Suzuki
2020-04-20  7:49 ` kbuild test robot

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=20200409.101844.1655988786538703860.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=keitasuzuki.park@sslab.ics.keio.ac.jp \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=takafumi.kubota1012@sslab.ics.keio.ac.jp \
    /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