[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200409123203.1b5f6534@kicinski-fedora-PC1C0HJN>
Date:   Thu, 9 Apr 2020 12:32:19 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Keita Suzuki <keitasuzuki.park@...ab.ics.keio.ac.jp>
Cc:     takafumi.kubota1012@...ab.ics.keio.ac.jp, davem@...emloft.net,
        oss-drivers@...ronome.com (open list:NETRONOME ETHERNET DRIVERS),
        netdev@...r.kernel.org (open list:NETWORKING DRIVERS),
        linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH] nfp: Fix memory leak in nfp_resource_acquire()
On Thu,  9 Apr 2020 17:41:11 +0000 Keita Suzuki wrote:
> 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().
I don't see a leak here. Maybe you could rephrase the description to
make things clearer?
AFAICS nfp_resource_try_acquire() calls nfp_cpp_mutex_free(res->mutex)
if it's about to return an error. We can only hit msleep or time check
if it returned an error.
Powered by blists - more mailing lists