Hi Zhenbo,

I do not think this patch is correct.

Function tipc_node_subscribe() calls tipc_node_find(). Function
tipc_node_find() calls kref_get_unless_zero() to increase node reference.
Therefore, after calling tipc_node_find (), we need to call tipc_node_put()
to decrease node reference.

Thanks.

Best regards,
Tung Nguyen

-----Original Message-----
From: Zhenbo Gao <[email protected]> 
Sent: Tuesday, May 22, 2018 9:16 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: [tipc-discussion] [PATCH] tipc: increase node's kref in function
tipc_node_subscribe()

tipc_node_get(n) should be called in function
tipc_node_subscribe() to increase the node's kref.

Signed-off-by: Zhenbo Gao <[email protected]>
---
 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 f29549d..cb4f36f 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -448,7 +448,7 @@ void tipc_node_subscribe(struct net *net, struct
list_head *subscr, u32 addr)
        tipc_node_write_lock(n);
        list_add_tail(subscr, &n->publ_list);
        tipc_node_write_unlock_fast(n);
-       tipc_node_put(n);
+       tipc_node_get(n);
 }
 
 void tipc_node_unsubscribe(struct net *net, struct list_head *subscr, u32
addr)
--
1.9.1


----------------------------------------------------------------------------
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to