]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/sched/act_mirred.c
Merge branch 'work.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux.git] / net / sched / act_mirred.c
index 9d1bf508075a8c789658ba7a08ac1c0a20cd63eb..9ce073a05414ae3289190446cb6cee057588f07d 100644 (file)
@@ -408,25 +408,31 @@ static struct notifier_block mirred_device_notifier = {
        .notifier_call = mirred_device_event,
 };
 
-static struct net_device *tcf_mirred_get_dev(const struct tc_action *a)
+static void tcf_mirred_dev_put(void *priv)
+{
+       struct net_device *dev = priv;
+
+       dev_put(dev);
+}
+
+static struct net_device *
+tcf_mirred_get_dev(const struct tc_action *a,
+                  tc_action_priv_destructor *destructor)
 {
        struct tcf_mirred *m = to_mirred(a);
        struct net_device *dev;
 
        rcu_read_lock();
        dev = rcu_dereference(m->tcfm_dev);
-       if (dev)
+       if (dev) {
                dev_hold(dev);
+               *destructor = tcf_mirred_dev_put;
+       }
        rcu_read_unlock();
 
        return dev;
 }
 
-static void tcf_mirred_put_dev(struct net_device *dev)
-{
-       dev_put(dev);
-}
-
 static size_t tcf_mirred_get_fill_size(const struct tc_action *act)
 {
        return nla_total_size(sizeof(struct tc_mirred));
@@ -446,7 +452,6 @@ static struct tc_action_ops act_mirred_ops = {
        .get_fill_size  =       tcf_mirred_get_fill_size,
        .size           =       sizeof(struct tcf_mirred),
        .get_dev        =       tcf_mirred_get_dev,
-       .put_dev        =       tcf_mirred_put_dev,
 };
 
 static __net_init int mirred_init_net(struct net *net)