[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2eefbb3d5190a2fb24ae075725166ceb2effb433.camel@redhat.com>
Date: Tue, 05 Jul 2022 15:03:18 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jianglei Nie <niejianglei2021@....com>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: macsec: fix potential resource leak in
macsec_add_rxsa() and macsec_add_txsa()
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@....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
Powered by blists - more mailing lists