Skip to content

Commit de52e17

Browse files
pchelkin91Paolo Abeni
authored andcommitted
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: cb8092d ("tipc: move bc link creation back to tipc_node_create") Suggested-by: Xin Long <[email protected]> Signed-off-by: Fedor Pchelkin <[email protected]> Reviewed-by: Xin Long <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent ecb4534 commit de52e17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tipc/node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id,
583583
n->capabilities, &n->bc_entry.inputq1,
584584
&n->bc_entry.namedq, snd_l, &n->bc_entry.link)) {
585585
pr_warn("Broadcast rcv link creation failed, no memory\n");
586-
kfree(n);
586+
tipc_node_put(n);
587587
n = NULL;
588588
goto exit;
589589
}

0 commit comments

Comments
 (0)