diff options
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r-- | net/tipc/subscr.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 271cd66e4b3b..0bf91cd3733c 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -54,8 +54,6 @@ struct tipc_subscriber { | |||
54 | 54 | ||
55 | static void tipc_subscrp_delete(struct tipc_subscription *sub); | 55 | static void tipc_subscrp_delete(struct tipc_subscription *sub); |
56 | static void tipc_subscrb_put(struct tipc_subscriber *subscriber); | 56 | static void tipc_subscrb_put(struct tipc_subscriber *subscriber); |
57 | static void tipc_subscrp_put(struct tipc_subscription *subscription); | ||
58 | static void tipc_subscrp_get(struct tipc_subscription *subscription); | ||
59 | 57 | ||
60 | /** | 58 | /** |
61 | * htohl - convert value to endianness used by destination | 59 | * htohl - convert value to endianness used by destination |
@@ -125,7 +123,6 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, | |||
125 | { | 123 | { |
126 | struct tipc_name_seq seq; | 124 | struct tipc_name_seq seq; |
127 | 125 | ||
128 | tipc_subscrp_get(sub); | ||
129 | tipc_subscrp_convert_seq(&sub->evt.s.seq, sub->swap, &seq); | 126 | tipc_subscrp_convert_seq(&sub->evt.s.seq, sub->swap, &seq); |
130 | if (!tipc_subscrp_check_overlap(&seq, found_lower, found_upper)) | 127 | if (!tipc_subscrp_check_overlap(&seq, found_lower, found_upper)) |
131 | return; | 128 | return; |
@@ -135,7 +132,6 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, | |||
135 | 132 | ||
136 | tipc_subscrp_send_event(sub, found_lower, found_upper, event, port_ref, | 133 | tipc_subscrp_send_event(sub, found_lower, found_upper, event, port_ref, |
137 | node); | 134 | node); |
138 | tipc_subscrp_put(sub); | ||
139 | } | 135 | } |
140 | 136 | ||
141 | static void tipc_subscrp_timeout(unsigned long data) | 137 | static void tipc_subscrp_timeout(unsigned long data) |
@@ -145,6 +141,7 @@ static void tipc_subscrp_timeout(unsigned long data) | |||
145 | 141 | ||
146 | spin_lock_bh(&subscriber->lock); | 142 | spin_lock_bh(&subscriber->lock); |
147 | tipc_nametbl_unsubscribe(sub); | 143 | tipc_nametbl_unsubscribe(sub); |
144 | list_del(&sub->subscrp_list); | ||
148 | spin_unlock_bh(&subscriber->lock); | 145 | spin_unlock_bh(&subscriber->lock); |
149 | 146 | ||
150 | /* Notify subscriber of timeout */ | 147 | /* Notify subscriber of timeout */ |
@@ -177,20 +174,17 @@ static void tipc_subscrp_kref_release(struct kref *kref) | |||
177 | struct tipc_net *tn = net_generic(sub->net, tipc_net_id); | 174 | struct tipc_net *tn = net_generic(sub->net, tipc_net_id); |
178 | struct tipc_subscriber *subscriber = sub->subscriber; | 175 | struct tipc_subscriber *subscriber = sub->subscriber; |
179 | 176 | ||
180 | spin_lock_bh(&subscriber->lock); | ||
181 | list_del(&sub->subscrp_list); | ||
182 | atomic_dec(&tn->subscription_count); | 177 | atomic_dec(&tn->subscription_count); |
183 | spin_unlock_bh(&subscriber->lock); | ||
184 | kfree(sub); | 178 | kfree(sub); |
185 | tipc_subscrb_put(subscriber); | 179 | tipc_subscrb_put(subscriber); |
186 | } | 180 | } |
187 | 181 | ||
188 | static void tipc_subscrp_put(struct tipc_subscription *subscription) | 182 | void tipc_subscrp_put(struct tipc_subscription *subscription) |
189 | { | 183 | { |
190 | kref_put(&subscription->kref, tipc_subscrp_kref_release); | 184 | kref_put(&subscription->kref, tipc_subscrp_kref_release); |
191 | } | 185 | } |
192 | 186 | ||
193 | static void tipc_subscrp_get(struct tipc_subscription *subscription) | 187 | void tipc_subscrp_get(struct tipc_subscription *subscription) |
194 | { | 188 | { |
195 | kref_get(&subscription->kref); | 189 | kref_get(&subscription->kref); |
196 | } | 190 | } |
@@ -210,11 +204,8 @@ static void tipc_subscrb_subscrp_delete(struct tipc_subscriber *subscriber, | |||
210 | continue; | 204 | continue; |
211 | 205 | ||
212 | tipc_nametbl_unsubscribe(sub); | 206 | tipc_nametbl_unsubscribe(sub); |
213 | tipc_subscrp_get(sub); | 207 | list_del(&sub->subscrp_list); |
214 | spin_unlock_bh(&subscriber->lock); | ||
215 | tipc_subscrp_delete(sub); | 208 | tipc_subscrp_delete(sub); |
216 | tipc_subscrp_put(sub); | ||
217 | spin_lock_bh(&subscriber->lock); | ||
218 | 209 | ||
219 | if (s) | 210 | if (s) |
220 | break; | 211 | break; |