]> Git Repo - linux.git/commitdiff
batman-adv: fix hardif_neigh refcount on queue_work() failure
authorMarek Lindner <[email protected]>
Thu, 6 Sep 2018 21:45:55 +0000 (05:45 +0800)
committerSimon Wunderlich <[email protected]>
Fri, 7 Sep 2018 06:14:26 +0000 (08:14 +0200)
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 <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
net/batman-adv/bat_v_elp.c

index e103c759b7ab24df7d47a7d8781ab9e676b451e8..9f481cfdf77dace2fa594585fde5079d46474c66 100644 (file)
@@ -268,6 +268,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
        struct batadv_priv *bat_priv;
        struct sk_buff *skb;
        u32 elp_interval;
+       bool ret;
 
        bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work);
        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)
                 * may sleep and that is not allowed in an rcu protected
                 * context. Therefore schedule a task for that.
                 */
-               queue_work(batadv_event_workqueue,
-                          &hardif_neigh->bat_v.metric_work);
+               ret = queue_work(batadv_event_workqueue,
+                                &hardif_neigh->bat_v.metric_work);
+
+               if (!ret)
+                       batadv_hardif_neigh_put(hardif_neigh);
        }
        rcu_read_unlock();
 
This page took 0.043282 seconds and 4 git commands to generate.