From: Fedor Pchelkin Date: Tue, 25 Jul 2023 21:46:25 +0000 (+0300) Subject: tipc: stop tipc crypto on failure in tipc_node_create X-Git-Tag: v6.6.7~2294^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de52e17326c3e9a719c9ead4adb03467b8fae0ef;p=platform%2Fkernel%2Flinux-starfive.git tipc: stop tipc crypto on failure in tipc_node_create 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 Signed-off-by: Fedor Pchelkin Reviewed-by: Xin Long Link: https://lore.kernel.org/r/20230725214628.25246-1-pchelkin@ispras.ru Signed-off-by: Paolo Abeni --- diff --git a/net/tipc/node.c b/net/tipc/node.c index 5e000fd..a9c5b65 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -583,7 +583,7 @@ update: 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; }