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]

 



On Thu, 2022-08-11 at 16:13 -0700, James Prestwood wrote:
> @@ -217,7 +275,11 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
>  	if (ret)
>  		return ret;
>  
> +	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().

Also, it seems like we should only add the interface again after
updating sdata->vif.addr (last context line), so that the driver
actually knows ... otherwise I'm not sure how this patch would have much
effect (unless it updates the FW all the time like iwlwifi, which I
guess is where you tested it, based on the rationale...)

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