Skip to content

Commit

Permalink
af_packet: mc_drop/flush_mclist changes
Browse files Browse the repository at this point in the history
We hold RTNL, we can use __dev_get_by_index() instead of dev_get_by_index()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 20, 2009
1 parent 94b0595 commit ad959e7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,11 +1664,9 @@ static int packet_mc_drop(struct sock *sk, struct packet_mreq_max *mreq)
if (--ml->count == 0) {
struct net_device *dev;
*mlp = ml->next;
dev = dev_get_by_index(sock_net(sk), ml->ifindex);
if (dev) {
dev = __dev_get_by_index(sock_net(sk), ml->ifindex);
if (dev)
packet_dev_mc(dev, ml, -1);
dev_put(dev);
}
kfree(ml);
}
rtnl_unlock();
Expand All @@ -1692,11 +1690,9 @@ static void packet_flush_mclist(struct sock *sk)
struct net_device *dev;

po->mclist = ml->next;
dev = dev_get_by_index(sock_net(sk), ml->ifindex);
if (dev != NULL) {
dev = __dev_get_by_index(sock_net(sk), ml->ifindex);
if (dev != NULL)
packet_dev_mc(dev, ml, -1);
dev_put(dev);
}
kfree(ml);
}
rtnl_unlock();
Expand Down

0 comments on commit ad959e7

Please sign in to comment.