lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190730060547.GA2312@nanopsycho.orion>
Date:   Tue, 30 Jul 2019 08:05:47 +0200
From:   Jiri Pirko <jiri@...nulli.us>
To:     David Miller <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, jakub.kicinski@...ronome.com,
        sthemmin@...rosoft.com, dsahern@...il.com, mlxsw@...lanox.com
Subject: Re: [patch net-next 1/3] net: devlink: allow to change namespaces

Mon, Jul 29, 2019 at 07:52:16PM CEST, davem@...emloft.net wrote:
>From: Jiri Pirko <jiri@...nulli.us>
>Date: Sat, 27 Jul 2019 11:44:57 +0200
>
>> +	if ((netns_pid_attr && (netns_fd_attr || netns_id_attr)) ||
>> +	    (netns_fd_attr && (netns_pid_attr || netns_id_attr)) ||
>> +	    (netns_id_attr && (netns_pid_attr || netns_fd_attr))) {
>> +		NL_SET_ERR_MSG(info->extack, "multiple netns identifying attributes specified");
>> +		return ERR_PTR(-EINVAL);
>> +	}
>
>How about:
>
>	if (!!a + !!b + !!c > 1) {
>	...

I just copied the logic from the existing code. But sure :)


>
>> +
>> +	if (netns_pid_attr) {
>> +		net = get_net_ns_by_pid(nla_get_u32(netns_pid_attr));
>> +	} else if (netns_fd_attr) {
>> +		net = get_net_ns_by_fd(nla_get_u32(netns_fd_attr));
>> +	} else if (netns_id_attr) {
>> +		net = get_net_ns_by_id(sock_net(skb->sk),
>> +				       nla_get_u32(netns_id_attr));
>> +		if (!net)
>> +			net = ERR_PTR(-EINVAL);
>> +	}
>> +	if (IS_ERR(net)) {
>
>I think this is going to be one of those cases where a compiler won't be able
>to prove that 'net' is guaranteed to be initialized at this spot.  Please
>rearrange this code somehow so that is unlikely to happen.

It does not complain though. The function cannot be entered unless at
least one is. I'll check again.


>
>Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ