]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tipc: stop tipc crypto on failure in tipc_node_create
authorFedor Pchelkin <pchelkin@ispras.ru>
Tue, 25 Jul 2023 21:46:25 +0000 (00:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Aug 2023 08:22:37 +0000 (10:22 +0200)
commit9dde876a4dc8cc8be8ed4ccf34c137723f968a3a
treefae488df87aa9639cf6ece7a67b941b98fa1ed97
parentdf019bc1241e68ded3de2cc328e8c61c100d8740
tipc: stop tipc crypto on failure in tipc_node_create

[ Upstream commit de52e17326c3e9a719c9ead4adb03467b8fae0ef ]

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>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/20230725214628.25246-1-pchelkin@ispras.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/node.c