After a subscription object is created, it's inserted into its
subscriber subscrp_list list under subscriber lock protection,
similarly, before it's destroyed, it should be first removed from
its subscriber->subscrp_list.

Signed-off-by: Ying Xue <[email protected]>
Reviewed-by: Jon Maloy <[email protected]>
---
 net/tipc/subscr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 9d94e65..e70e7ba 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -174,7 +174,6 @@ static void tipc_subscrp_kref_release(struct kref *kref)
 
        spin_lock_bh(&subscriber->lock);
        tipc_nametbl_unsubscribe(sub);
-       list_del(&sub->subscrp_list);
        atomic_dec(&tn->subscription_count);
        spin_unlock_bh(&subscriber->lock);
        kfree(sub);
@@ -205,6 +204,8 @@ static void tipc_subscrb_subscrp_delete(struct 
tipc_subscriber *subscriber,
                if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr)))
                        continue;
 
+               list_del(&sub->subscrp_list);
+
                tipc_subscrp_get(sub);
                spin_unlock_bh(&subscriber->lock);
                tipc_subscrp_delete(sub);
@@ -305,6 +306,7 @@ static void tipc_subscrp_subscribe(struct net *net, struct 
tipc_subscr *s,
 
        spin_lock_bh(&subscriber->lock);
        list_add(&sub->subscrp_list, &subscriber->subscrp_list);
+
        sub->subscriber = subscriber;
        tipc_nametbl_subscribe(sub);
        tipc_subscrb_get(subscriber);
-- 
2.7.4


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to