aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Lindner <mareklindner@neomailbox.ch>2018-09-06 17:45:55 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2018-09-07 02:14:26 -0400
commit4c4af6900844ab04c9434c972021d7b48610e06a (patch)
tree29a6de6b545080cd75b59576be49320c91cef869
parent5af96b9c59c72fb2af2d19c5cc2f3cdcee391dff (diff)
batman-adv: fix hardif_neigh refcount on queue_work() failure
The hardif_neigh refcounter is to be decreased by the queued work and currently is never decreased if the queue_work() call fails. Fix by checking the queue_work() return value and decrease refcount if necessary. Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
-rw-r--r--net/batman-adv/bat_v_elp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index e103c759b7ab..9f481cfdf77d 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -268,6 +268,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
268 struct batadv_priv *bat_priv; 268 struct batadv_priv *bat_priv;
269 struct sk_buff *skb; 269 struct sk_buff *skb;
270 u32 elp_interval; 270 u32 elp_interval;
271 bool ret;
271 272
272 bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work); 273 bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work);
273 hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v); 274 hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v);
@@ -329,8 +330,11 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
329 * may sleep and that is not allowed in an rcu protected 330 * may sleep and that is not allowed in an rcu protected
330 * context. Therefore schedule a task for that. 331 * context. Therefore schedule a task for that.
331 */ 332 */
332 queue_work(batadv_event_workqueue, 333 ret = queue_work(batadv_event_workqueue,
333 &hardif_neigh->bat_v.metric_work); 334 &hardif_neigh->bat_v.metric_work);
335
336 if (!ret)
337 batadv_hardif_neigh_put(hardif_neigh);
334 } 338 }
335 rcu_read_unlock(); 339 rcu_read_unlock();
336 340