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: <81d39fab6a85981b28329a67b454ca92e7e377f8.camel@redhat.com>
Date: Tue, 21 May 2024 12:38:16 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Roded Zats <rzats@...oaltonetworks.com>, benve@...co.com, 
 satishkh@...co.com, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org
Cc: orcohen@...oaltonetworks.com, netdev@...r.kernel.org
Subject: Re: [PATCH net] enic: Validate length of nl attributes in
 enic_set_vf_port

On Thu, 2024-05-16 at 18:42 +0300, Roded Zats wrote:
> enic_set_vf_port assumes that the nl attribute IFLA_PORT_PROFILE
> is of length PORT_PROFILE_MAX and that the nl attributes
> IFLA_PORT_INSTANCE_UUID, IFLA_PORT_HOST_UUID are of length PORT_UUID_MAX.
> These attributes are validated (in the function do_setlink in rtnetlink.c)
> using the nla_policy ifla_port_policy. The policy defines IFLA_PORT_PROFILE
> as NLA_STRING, IFLA_PORT_INSTANCE_UUID as NLA_BINARY and
> IFLA_PORT_HOST_UUID as NLA_STRING. That means that the length validation
> using the policy is for the max size of the attributes and not on exact
> size so the length of these attributes might be less than the sizes that
> enic_set_vf_port expects. This might cause an out of bands
> read access in the memcpys of the data of these
> attributes in enic_set_vf_port.
> 
> Fixes: f8bd909183ac ("net: Add ndo_{set|get}_vf_port support for enic dynamic vnics")
> Signed-off-by: Roded Zats <rzats@...oaltonetworks.com>
> ---
>  drivers/net/ethernet/cisco/enic/enic_main.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index f604119efc80..4179c6f9580d 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
> @@ -1117,18 +1117,30 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
>  	pp->request = nla_get_u8(port[IFLA_PORT_REQUEST]);
>  
>  	if (port[IFLA_PORT_PROFILE]) {
> +		if (nla_len(port[IFLA_PORT_PROFILE]) != PORT_PROFILE_MAX) {
> +			memcpy(pp, &prev_pp, sizeof(*pp));
> +			return -EOPNOTSUPP;

I think -EOPNOTSUPP is misleading here (and below), -EINVAL should be
appropriate.

Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ