From: Paolo Abeni <pabeni@redhat.com>
To: Jianglei Nie <niejianglei2021@163.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: macsec: fix potential resource leak in macsec_add_rxsa() and macsec_add_txsa()
Date: Tue, 05 Jul 2022 15:03:18 +0200 [thread overview]
Message-ID: <2eefbb3d5190a2fb24ae075725166ceb2effb433.camel@redhat.com> (raw)
In-Reply-To: <20220704123304.2239147-1-niejianglei2021@163.com>
Hello,
On Mon, 2022-07-04 at 20:33 +0800, Jianglei Nie wrote:
> init_rx_sa() allocates relevant resource for rx_sa->stats and rx_sa->
> key.tfm with alloc_percpu() and macsec_alloc_tfm(). When some error
> occurs after init_rx_sa() is called in macsec_add_rxsa(), the function
> released rx_sa with kfree() without releasing rx_sa->stats and rx_sa->
> key.tfm, which will lead to a resource leak.
>
> We should call macsec_rxsa_put() instead of kfree() to decrease the ref
> count of rx_sa and release the relevant resource if the refcount is 0.
> The same bug exists in macsec_add_txsa() for tx_sa as well. This patch
> fixes the above two bugs.
>
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
The patch LGTM. This looks like -net material, so please repost
specifying the correct tree into the patch subj and more importantnly
including a suitable 'Fixes' tag into the commit message.
Thanks!
Paolo
next prev parent reply other threads:[~2022-07-05 13:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 12:33 [PATCH] net: macsec: fix potential resource leak in macsec_add_rxsa() and macsec_add_txsa() Jianglei Nie
2022-07-05 13:03 ` Paolo Abeni [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-06 7:48 Jianglei Nie
2022-07-07 7:38 ` Paolo Abeni
2022-07-22 9:29 Jianglei Nie
2022-07-25 11:00 ` patchwork-bot+netdevbpf
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=2eefbb3d5190a2fb24ae075725166ceb2effb433.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=niejianglei2021@163.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