Skip to content

Commit

Permalink
netlabel: remove dev_put() calls
Browse files Browse the repository at this point in the history
Use dev_get_by_name_rcu() to avoid dev_put() calls,
in sections already inside a rcu_read_lock()

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Nov 6, 2009
1 parent 31ef30c commit 122ec6f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/netlabel/netlabel_unlabeled.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,12 @@ int netlbl_unlhsh_add(struct net *net,

rcu_read_lock();
if (dev_name != NULL) {
dev = dev_get_by_name(net, dev_name);
dev = dev_get_by_name_rcu(net, dev_name);
if (dev == NULL) {
ret_val = -ENODEV;
goto unlhsh_add_return;
}
ifindex = dev->ifindex;
dev_put(dev);
iface = netlbl_unlhsh_search_iface(ifindex);
} else {
ifindex = 0;
Expand Down Expand Up @@ -737,13 +736,12 @@ int netlbl_unlhsh_remove(struct net *net,

rcu_read_lock();
if (dev_name != NULL) {
dev = dev_get_by_name(net, dev_name);
dev = dev_get_by_name_rcu(net, dev_name);
if (dev == NULL) {
ret_val = -ENODEV;
goto unlhsh_remove_return;
}
iface = netlbl_unlhsh_search_iface(dev->ifindex);
dev_put(dev);
} else
iface = rcu_dereference(netlbl_unlhsh_def);
if (iface == NULL) {
Expand Down

0 comments on commit 122ec6f

Please sign in to comment.