Commit 122ec6ff authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

netlabel: remove dev_put() calls

Use dev_get_by_name_rcu() to avoid dev_put() calls,
in sections already inside a rcu_read_lock()
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31ef30c7
...@@ -472,13 +472,12 @@ int netlbl_unlhsh_add(struct net *net, ...@@ -472,13 +472,12 @@ int netlbl_unlhsh_add(struct net *net,
rcu_read_lock(); rcu_read_lock();
if (dev_name != NULL) { if (dev_name != NULL) {
dev = dev_get_by_name(net, dev_name); dev = dev_get_by_name_rcu(net, dev_name);
if (dev == NULL) { if (dev == NULL) {
ret_val = -ENODEV; ret_val = -ENODEV;
goto unlhsh_add_return; goto unlhsh_add_return;
} }
ifindex = dev->ifindex; ifindex = dev->ifindex;
dev_put(dev);
iface = netlbl_unlhsh_search_iface(ifindex); iface = netlbl_unlhsh_search_iface(ifindex);
} else { } else {
ifindex = 0; ifindex = 0;
...@@ -737,13 +736,12 @@ int netlbl_unlhsh_remove(struct net *net, ...@@ -737,13 +736,12 @@ int netlbl_unlhsh_remove(struct net *net,
rcu_read_lock(); rcu_read_lock();
if (dev_name != NULL) { if (dev_name != NULL) {
dev = dev_get_by_name(net, dev_name); dev = dev_get_by_name_rcu(net, dev_name);
if (dev == NULL) { if (dev == NULL) {
ret_val = -ENODEV; ret_val = -ENODEV;
goto unlhsh_remove_return; goto unlhsh_remove_return;
} }
iface = netlbl_unlhsh_search_iface(dev->ifindex); iface = netlbl_unlhsh_search_iface(dev->ifindex);
dev_put(dev);
} else } else
iface = rcu_dereference(netlbl_unlhsh_def); iface = rcu_dereference(netlbl_unlhsh_def);
if (iface == NULL) { if (iface == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment