bridge: remove dev_put() in add_del_if()
Subsystems (3)
PATCH 1/1 bridge: remove dev_put() in add_del_if()
add_del_if() is called with RTNL, we can use __dev_get_by_index() instead of [dev_get_by_index() + dev_put()]
--- net/bridge/br_ioctl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/bridge/br_ioctl.c +2 -2
@@ -81,6 +81,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,return num; } +/* called with RTNL */ static int add_del_if (struct net_bridge *br,int ifindex,int isadd) {struct net_device *dev;
@@ -89,7 +90,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)if (!capable (CAP_NET_ADMIN ))return -EPERM ; - dev =dev_get_by_index (dev_net (br->dev), ifindex); + dev =__dev_get_by_index (dev_net (br->dev), ifindex);if (dev ==NULL )return -EINVAL ;
@@ -98,7 +99,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)else ret =br_del_if (br, dev); -dev_put (dev);return ret; }
Quoted 30 lines · On Wed, 04 Nov 2009 20:09:07 +0100 Eric Dumazet <[email protected]> wrote:
add_del_if()is called with RTNL, we can use__dev_get_by_index()instead of [dev_get_by_index()+dev_put()]Signed-off-by Eric Dumazet <[email protected]>--- net/bridge/br_ioctl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)net/bridge/br_ioctl.c +2
-1@@ -81,6 +81,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,return num; } +/* called with RTNL */ static int add_del_if (struct net_bridge *br,int ifindex,int isadd) {struct net_device *dev;@@ -89,7 +90,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)if (!capable (CAP_NET_ADMIN ))return -EPERM ; - dev =dev_get_by_index (dev_net (br->dev), ifindex); + dev =__dev_get_by_index (dev_net (br->dev), ifindex);if (dev ==NULL )return -EINVAL ;
net/bridge/br_ioctl.c static int add_del_if(struct net_bridge *br, int ifindex, int isadd) · line 104
Quoted 7 lines
net/bridge/br_ioctl.c +0
-1@@ -98,7 +99,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)else ret =br_del_if (br, dev); -dev_put (dev);return ret; }
As part of the general ref count purge sure.
Quoted 4 lines · Stephen Hemminger
As part of the general ref count purge sure.
Yes, sure... but nf_queue.c is such an abuser that I doubt we really can make dev_put() doing the atomic_dec_test() one day...
From: Stephen Hemminger <[email protected]>
Date: Wed, 4 Nov 2009 11:40:20 -0800
Quoted 7 lines
Quoted 4 lines · On Wed, 04 Nov 2009 20:09:07 +0100 Eric Dumazet <[email protected]> wrote:
add_del_if()is called with RTNL, we can use__dev_get_by_index()instead of [dev_get_by_index()+dev_put()]Signed-off-by Eric Dumazet <[email protected]>
...
Quoted 3 lines
As part of the general ref count purge sure.
Applied, thanks everyone.