diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-01-14 21:23:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-14 21:50:46 -0500 |
commit | 737639493032afec87fc9e8809f80878f74bd465 (patch) | |
tree | c45130aeceaee76e1a4ec7b20d092d1cb3afb1ce /drivers/net/vxlan.c | |
parent | d4c5fba2f6c272ed687fe6351e5b20bc60cf24f0 (diff) |
vxlan: use __dev_get_by_index instead of dev_get_by_index to find interface
The following call chains indicate that vxlan_fdb_parse() is
under rtnl_lock protection. So if we use __dev_get_by_index()
instead of dev_get_by_index() to find interface handler in it,
this would help us avoid to change interface reference counter.
rtnetlink_rcv()
rtnl_lock()
netlink_rcv_skb()
rtnl_fdb_add()
vxlan_fdb_add()
vxlan_fdb_parse()
rtnl_unlock()
rtnetlink_rcv()
rtnl_lock()
netlink_rcv_skb()
rtnl_fdb_del()
vxlan_fdb_del()
vxlan_fdb_parse()
rtnl_unlock()
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 481f85d604a4..8c40802e7dd9 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -741,10 +741,9 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, | |||
741 | if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32)) | 741 | if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32)) |
742 | return -EINVAL; | 742 | return -EINVAL; |
743 | *ifindex = nla_get_u32(tb[NDA_IFINDEX]); | 743 | *ifindex = nla_get_u32(tb[NDA_IFINDEX]); |
744 | tdev = dev_get_by_index(net, *ifindex); | 744 | tdev = __dev_get_by_index(net, *ifindex); |
745 | if (!tdev) | 745 | if (!tdev) |
746 | return -EADDRNOTAVAIL; | 746 | return -EADDRNOTAVAIL; |
747 | dev_put(tdev); | ||
748 | } else { | 747 | } else { |
749 | *ifindex = 0; | 748 | *ifindex = 0; |
750 | } | 749 | } |