Commit bd27a8750c9b849068d80e298f99940bb7128b33

Authored by Eric Dumazet
Committed by David S. Miller
1 parent 40c9c31e38

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>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -404,6 +404,7 @@
404 404 a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER);
405 405 }
406 406  
  407 +/* called with RTNL */
407 408 static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
408 409 {
409 410 struct net *net = sock_net(skb->sk);
... ... @@ -422,7 +423,7 @@
422 423  
423 424 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
424 425 return skb->len;
425   - if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
  426 + if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
426 427 return skb->len;
427 428  
428 429 if (!tcm->tcm_parent)
... ... @@ -484,7 +485,6 @@
484 485 if (cl)
485 486 cops->put(q, cl);
486 487 out:
487   - dev_put(dev);
488 488 return skb->len;
489 489 }
490 490