소스 검색

netfilter: IDLETIMER: fix race condition when destroy the target

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>
Liping Zhang 9 년 전
부모
커밋
cec5913c15
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      net/netfilter/xt_IDLETIMER.c

+ 1 - 0
net/netfilter/xt_IDLETIMER.c

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