summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-06 05:57:26 +0100
committerDavid S. Miller <davem@davemloft.net>2009-11-06 07:34:21 +0100
commitbd27a8750c9b849068d80e298f99940bb7128b33 (patch)
tree606acde68192483fe9800b5b7afc3628857a1e60
parentsctp: ipv6: avoid touching device refcount (diff)
downloadlinux-bd27a8750c9b849068d80e298f99940bb7128b33.tar.xz
linux-bd27a8750c9b849068d80e298f99940bb7128b33.zip
net_cls: Use __dev_get_by_index()
We hold RTNL in tc_dump_tfilter(), we can avoid dev_hold()/dev_put() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/cls_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 7cf6c0fbc7a6..c024da77824f 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -404,6 +404,7 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n,
a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER);
}
+/* called with RTNL */
static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
@@ -422,7 +423,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
return skb->len;
- if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
+ if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
return skb->len;
if (!tcm->tcm_parent)
@@ -484,7 +485,6 @@ errout:
if (cl)
cops->put(q, cl);
out:
- dev_put(dev);
return skb->len;
}