]> git.karo-electronics.de Git - linux-beck.git/commitdiff
netfilter: IDLETIMER: fix race condition when destroy the target
authorLiping Zhang <liping.zhang@spreadtrum.com>
Thu, 21 Apr 2016 07:47:08 +0000 (00:47 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Apr 2016 12:28:48 +0000 (14:28 +0200)
Workqueue maybe still in running while we destroy the IDLETIMER target,
thus cause a use after free error, add cancel_work_sync() to avoid such
situation.

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_IDLETIMER.c

index 29d2c31f406ca585d5f0eb1f08bcaf26d8364053..daf45da448fab4406cf4b5727404c88c1f0759be 100644 (file)
@@ -236,6 +236,7 @@ static void idletimer_tg_destroy(const struct xt_tgdtor_param *par)
 
                list_del(&info->timer->entry);
                del_timer_sync(&info->timer->timer);
+               cancel_work_sync(&info->timer->work);
                sysfs_remove_file(idletimer_tg_kobj, &info->timer->attr.attr);
                kfree(info->timer->attr.attr.name);
                kfree(info->timer);