From: Xin Long <lucien.xin@gmail.com>
To: Fedor Pchelkin <pchelkin@ispras.ru>
Cc: Jon Maloy <jmaloy@redhat.com>, Ying Xue <ying.xue@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Alexey Khoroshilov <khoroshilov@ispras.ru>,
lvc-project@linuxtesting.org
Subject: Re: [PATCH v2] tipc: stop tipc crypto on failure in tipc_node_create
Date: Tue, 25 Jul 2023 17:55:39 -0400 [thread overview]
Message-ID: <CADvbK_eUm0KF1GOSkOu5HRO91yr3BSD8Ha9kh3b+Omd=pPNdvg@mail.gmail.com> (raw)
In-Reply-To: <20230725214628.25246-1-pchelkin@ispras.ru>
On Tue, Jul 25, 2023 at 5:46 PM Fedor Pchelkin <pchelkin@ispras.ru> wrote:
>
> If tipc_link_bc_create() fails inside tipc_node_create() for a newly
> allocated tipc node then we should stop its tipc crypto and free the
> resources allocated with a call to tipc_crypto_start().
>
> As the node ref is initialized to one to that point, just put the ref on
> tipc_link_bc_create() error case that would lead to tipc_node_free() be
> eventually executed and properly clean the node and its crypto resources.
>
> Found by Linux Verification Center (linuxtesting.org).
>
> Fixes: cb8092d70a6f ("tipc: move bc link creation back to tipc_node_create")
> Suggested-by: Xin Long <lucien.xin@gmail.com>
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
> v1->v2: simplify the patch per Xin Long's advice: putting the ref on error
> case would solve the problem more conveniently; update the patch
> description accordingly.
>
> net/tipc/node.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/tipc/node.c b/net/tipc/node.c
> index 5e000fde8067..a9c5b6594889 100644
> --- a/net/tipc/node.c
> +++ b/net/tipc/node.c
> @@ -583,7 +583,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id,
> n->capabilities, &n->bc_entry.inputq1,
> &n->bc_entry.namedq, snd_l, &n->bc_entry.link)) {
> pr_warn("Broadcast rcv link creation failed, no memory\n");
> - kfree(n);
> + tipc_node_put(n);
> n = NULL;
> goto exit;
> }
> --
> 2.41.0
>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
next prev parent reply other threads:[~2023-07-25 21:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 18:36 [PATCH] tipc: stop tipc crypto on failure in tipc_node_create Fedor Pchelkin
2023-07-25 19:46 ` Xin Long
2023-07-25 21:38 ` Fedor Pchelkin
2023-07-25 21:46 ` [PATCH v2] " Fedor Pchelkin
2023-07-25 21:55 ` Xin Long [this message]
2023-07-27 10:10 ` 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='CADvbK_eUm0KF1GOSkOu5HRO91yr3BSD8Ha9kh3b+Omd=pPNdvg@mail.gmail.com' \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jmaloy@redhat.com \
--cc=khoroshilov@ispras.ru \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pchelkin@ispras.ru \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.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).