* [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if()
@ 2009-11-04 19:09 Eric Dumazet
2009-11-04 19:40 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2009-11-04 19:09 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List, Stephen Hemminger
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 <eric.dumazet@gmail.com>
---
net/bridge/br_ioctl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 6a6433d..2af6e4a 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if()
2009-11-04 19:09 [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if() Eric Dumazet
@ 2009-11-04 19:40 ` Stephen Hemminger
2009-11-04 19:43 ` Eric Dumazet
2009-11-06 5:07 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2009-11-04 19:40 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List
On Wed, 04 Nov 2009 20:09:07 +0100
Eric Dumazet <eric.dumazet@gmail.com> 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 <eric.dumazet@gmail.com>
> ---
> net/bridge/br_ioctl.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
> index 6a6433d..2af6e4a 100644
> --- a/net/bridge/br_ioctl.c
> +++ b/net/bridge/br_ioctl.c
> @@ -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;
> }
>
As part of the general ref count purge sure.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
--
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if()
2009-11-04 19:40 ` Stephen Hemminger
@ 2009-11-04 19:43 ` Eric Dumazet
2009-11-06 5:07 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2009-11-04 19:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, Linux Netdev List
Stephen Hemminger a écrit :
>
> As part of the general ref count purge sure.
> Acked-by: Stephen Hemminger <shemminger@vyatta.com>
>
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...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if()
2009-11-04 19:40 ` Stephen Hemminger
2009-11-04 19:43 ` Eric Dumazet
@ 2009-11-06 5:07 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2009-11-06 5:07 UTC (permalink / raw)
To: shemminger; +Cc: eric.dumazet, netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 4 Nov 2009 11:40:20 -0800
> On Wed, 04 Nov 2009 20:09:07 +0100
> Eric Dumazet <eric.dumazet@gmail.com> 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 <eric.dumazet@gmail.com>
...
>
> As part of the general ref count purge sure.
> Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-06 5:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 19:09 [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if() Eric Dumazet
2009-11-04 19:40 ` Stephen Hemminger
2009-11-04 19:43 ` Eric Dumazet
2009-11-06 5:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).