mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 00:50:54 +07:00
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>
This commit is contained in:
parent
40c9c31e38
commit
bd27a8750c
@ -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);
|
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)
|
static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
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)))
|
if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
|
||||||
return skb->len;
|
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;
|
return skb->len;
|
||||||
|
|
||||||
if (!tcm->tcm_parent)
|
if (!tcm->tcm_parent)
|
||||||
@ -484,7 +485,6 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
if (cl)
|
if (cl)
|
||||||
cops->put(q, cl);
|
cops->put(q, cl);
|
||||||
out:
|
out:
|
||||||
dev_put(dev);
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user