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]
Date:   Mon, 29 Jul 2019 10:52:16 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     jiri@...nulli.us
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

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) {
	...

> +
> +	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.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ