summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-07-16 14:25:31 -0700
committerDavid S. Miller <davem@davemloft.net>2014-07-20 20:31:42 -0700
commit224e923cd9b001c612b7b68933264156271722f9 (patch)
tree0b1d32fe64e7157ac362a4d5778c9aae0cf5bfad
parente81fbf6cd65247e6c65719eacf2af5856db3d5a9 (diff)
downloadop-kernel-dev-224e923cd9b001c612b7b68933264156271722f9.zip
op-kernel-dev-224e923cd9b001c612b7b68933264156271722f9.tar.gz
net_sched: hold tcf_lock in netdevice notifier
We modify mirred action (m->tcfm_dev) in netdev event, we need to prevent on-going mirred actions from reading freed m->tcfm_dev. So we need to acquire this spin lock. Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <cwang@twopensource.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_mirred.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 4f912c0..eb48306 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -218,10 +218,12 @@ static int mirred_device_event(struct notifier_block *unused,
if (event == NETDEV_UNREGISTER)
list_for_each_entry(m, &mirred_list, tcfm_list) {
+ spin_lock_bh(&m->tcf_lock);
if (m->tcfm_dev == dev) {
dev_put(dev);
m->tcfm_dev = NULL;
}
+ spin_unlock_bh(&m->tcf_lock);
}
return NOTIFY_DONE;
OpenPOWER on IntegriCloud