[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1350942738.8609.1375.camel@edumazet-glaptop>
Date: Mon, 22 Oct 2012 23:52:18 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Brian Haley <brian.haley@...com>
Cc: Pavel Emelyanov <xemul@...allels.com>,
Linux Netdev List <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH net-next] sockopt: Make SO_BINDTODEVICE readable
On Mon, 2012-10-22 at 17:47 -0400, Brian Haley wrote:
> On 10/22/2012 05:37 PM, Eric Dumazet wrote:
> > On Mon, 2012-10-22 at 17:20 -0400, Brian Haley wrote:
> >
> >> It's not much different from what's there:
> >>
> >> setsockopt("foo");
> >>
> >> rename foo -> bar
> >>
> >> index = getsockopt();
> >> if_indextoname(index) -> "bar"
> >>
> >> I more raised the issue since you pass a 'char *' to setsockopt() but an 'int *'
> >> to getsockopt(), I don't think any other value is non-symmetrical like this.
> >>
> >> -Brian
> >
> > I meant another cpu can be changing dev->name[] content while the
> > strcpy() is done, and you get a mangled devname, like "for" or "bao"
> > instead of "foo" or "bar"
>
> Even when holding the rcu_read_lock()? I'd have to hold the rtnl lock there?
Yes, rcu_read_lock() only makes sure the device doesnt disappear.
But its name can be changed.
You could use a seqcount_t, so that readers dont have to lock rtnl.
But do we really want to return a name here, I am not yet convinced.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists