Search Linux Wireless

Re: [PATCH v2 2/2] mac80211: Support POWERED_ADDR_CHANGE feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
> > > +       if (live)
> > > +               drv_remove_interface(local, sdata);
> > >         ret = eth_mac_addr(dev, sa);
> > > +       if (live)
> > > +               ret = drv_add_interface(local, sdata);
> > >  
> > >         if (ret == 0)
> > >                 memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN);
> > > 
> > 
> > I still don't like the (lack of) error checking here. As far as I know,
> > eth_mac_addr() can very happily fail if the passed address is invalid,
> > so we really shouldn't overwrite the ret value by drv_add_interface().
> 
> Ah yes, that was an oversight. I assume we do want to add_interface
> even if eth_mac_addr fails though.

Right.

> So my only question is about the
> return from drv_add_interface(). Is this unlikely to fail? If so would
> just a WARN_ON be sufficient and return the value from eth_mac_addr()?

Hm, yeah, I guess it really ought to not fail here.

> So something like:
> 
> 	if (live)
> 		drv_remove_interface(local, sdata);
> 	ret = eth_mac_addr(dev, sa);
> 	if (ret == 0)
> 		memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN);
> 
> 	if (live)
> 		WARN_ON(drv_add_interface(local, sdata));
> 
> 	return ret;

Seems reasonable. We could do something like

  err = drv_add_interface(...);
  if (err) {
     dev_close(...);
     ret = ret ?: err;
  }

or something, but not sure that's worth it, it really shouldn't fail at
this point.

But I guess we could leave setting NL80211_EXT_FEATURE_AUTH_TX_RANDOM_TA
to the driver if we think it'd be less risky that way?

johannes




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux