All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Pirko <jpirko@redhat.com>,
	netdev@vger.kernel.org, shimoda.hiroaki@gmail.com,
	virtualization@lists.linux-foundation.org,
	danny.kukawka@bisect.de, edumazet@google.com,
	davem@davemloft.net
Subject: Re: [patch net-next 1/4] net: introduce new priv_flag indicating iface capable of change mac when running
Date: Thu, 28 Jun 2012 23:32:34 +0300	[thread overview]
Message-ID: <20120628203234.GA15451@redhat.com> (raw)
In-Reply-To: <1340897092.13187.110.camel@edumazet-glaptop>

On Thu, Jun 28, 2012 at 05:24:52PM +0200, Eric Dumazet wrote:
> On Thu, 2012-06-28 at 16:10 +0200, Jiri Pirko wrote:
> > Introduce IFF_LIFE_ADDR_CHANGE priv_flag and use it to disable
> > netif_running() check in eth_mac_addr()
> > 
> > Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> > ---
> >  include/linux/if.h |    2 ++
> >  net/ethernet/eth.c |    2 +-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/if.h b/include/linux/if.h
> > index f995c66..fd9ee7c 100644
> > --- a/include/linux/if.h
> > +++ b/include/linux/if.h
> > @@ -81,6 +81,8 @@
> >  #define IFF_UNICAST_FLT	0x20000		/* Supports unicast filtering	*/
> >  #define IFF_TEAM_PORT	0x40000		/* device used as team port */
> >  #define IFF_SUPP_NOFCS	0x80000		/* device supports sending custom FCS */
> > +#define IFF_LIFE_ADDR_CHANGE 0x100000	/* device supports hardware address
> > +					 * change when it's running */
> >  
> > 
> >  #define IF_GET_IFACE	0x0001		/* for querying only */
> > diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
> > index 36e5880..8f8ded4 100644
> > --- a/net/ethernet/eth.c
> > +++ b/net/ethernet/eth.c
> > @@ -283,7 +283,7 @@ int eth_mac_addr(struct net_device *dev, void *p)
> >  {
> >  	struct sockaddr *addr = p;
> >  
> > -	if (netif_running(dev))
> > +	if (!(dev->priv_flags & IFF_LIFE_ADDR_CHANGE) && netif_running(dev))
> >  		return -EBUSY;
> >  	if (!is_valid_ether_addr(addr->sa_data))
> >  		return -EADDRNOTAVAIL;
> 
> Since the memcpy() is not atomic, there is a small window where a reader
> could get a half-changed mac address. I guess its a detail.
> 

At least for virtio nothing changes - we had this bug forever.
How'd you fix this?

-- 
MST

  reply	other threads:[~2012-06-28 20:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 14:10 [patch net-next 0/4] net: introduce and use IFF_LIFE_ADDR_CHANGE Jiri Pirko
2012-06-28 14:10 ` [patch net-next 1/4] net: introduce new priv_flag indicating iface capable of change mac when running Jiri Pirko
2012-06-28 15:24   ` Eric Dumazet
2012-06-28 20:32     ` Michael S. Tsirkin [this message]
2012-06-28 22:17   ` Ben Hutchings
2012-06-29  6:41     ` Jiri Pirko
2012-06-28 14:10 ` [patch net-next 2/4] virtio_net: use IFF_LIFE_ADDR_CHANGE priv_flag Jiri Pirko
2012-06-28 19:21   ` Michael S. Tsirkin
2012-06-28 14:10 ` [patch net-next 3/4] team: " Jiri Pirko
2012-06-28 14:10 ` [patch net-next 4/4] dummy: " Jiri Pirko
2012-06-28 14:10 ` Jiri Pirko
2012-06-28 15:15 ` [patch net-next 0/4] net: introduce and use IFF_LIFE_ADDR_CHANGE Richard Cochran
2012-06-28 15:41   ` Jiri Pirko
2012-06-28 15:15 ` Richard Cochran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120628203234.GA15451@redhat.com \
    --to=mst@redhat.com \
    --cc=danny.kukawka@bisect.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shimoda.hiroaki@gmail.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.