Am 15.01.2018 um 13:14 schrieb Johannes Berg:
> On Wed, 2018-01-10 at 17:42 +0100, Benjamin Beichler wrote:
>>  
>> +    if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
>> +            if (nla_len(info->attrs[HWSIM_ATTR_PERM_ADDR]) != ETH_ALEN) {
>> +                    pr_debug("mac80211_hwsim: MAC has wrong size\n");
>> +                    return -EINVAL;
>> +            }
> Oh, also - don't do this.
>
> 1) don't print, use NL_SET_ERR_MSG().
Ok, I only adapted the code already there, but I change this.
>
> 2) use the policy to validate lengths
Yeah, of course I change that, much easier -.-

>
>> +            if (!is_local_ether_addr(
>> +                            nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
>> +                    pr_debug("mac80211_hwsim: MAC is not locally 
>> administered\n");
>> +                    return -EINVAL;
>> +            }
> This doesn't really matter - it's purely virtual. I think we can avoid
> that.
>
>> +            if (get_hwsim_data_ref_from_addr(
>> +                            nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
>> +                    pr_debug("mac80211_hwsim: perm MAC already in use\n");
>> +                    return -EINVAL;
>> +            }
> This is racy afaict - remove it and return a clash later when you fail
> to insert the new radio.
Ehm yes, actually exactly this test is already in the rhashtable patch.
But maybe I should also change there the error print to a NL_ERR_MSG() ?

>
> johannes
>

-- 
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: [email protected]
www: http://www.imd.uni-rostock.de/



Reply via email to