All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net] act_ife: fix a potential use-after-free
@ 2018-09-03 18:08 Cong Wang
  2018-09-04 19:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2018-09-03 18:08 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Jamal Hadi Salim

Immediately after module_put(), user could delete this
module, so e->ops could be already freed before we call
e->ops->release().

Fix this by moving module_put() after ops->release().

Fixes: ef6980b6becb ("introduce IFE action")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/sched/act_ife.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 196430aefe87..fc412769a1be 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -400,7 +400,6 @@ static void _tcf_ife_cleanup(struct tc_action *a)
 	struct tcf_meta_info *e, *n;
 
 	list_for_each_entry_safe(e, n, &ife->metalist, metalist) {
-		module_put(e->ops->owner);
 		list_del(&e->metalist);
 		if (e->metaval) {
 			if (e->ops->release)
@@ -408,6 +407,7 @@ static void _tcf_ife_cleanup(struct tc_action *a)
 			else
 				kfree(e->metaval);
 		}
+		module_put(e->ops->owner);
 		kfree(e);
 	}
 }
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch net] act_ife: fix a potential use-after-free
  2018-09-03 18:08 [Patch net] act_ife: fix a potential use-after-free Cong Wang
@ 2018-09-04 19:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-09-04 19:19 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, jhs

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon,  3 Sep 2018 11:08:15 -0700

> Immediately after module_put(), user could delete this
> module, so e->ops could be already freed before we call
> e->ops->release().
> 
> Fix this by moving module_put() after ops->release().
> 
> Fixes: ef6980b6becb ("introduce IFE action")
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied and queued up for -stable, thanks Cong.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-04 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 18:08 [Patch net] act_ife: fix a potential use-after-free Cong Wang
2018-09-04 19:19 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.