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: <c3a580a5-cc6d-4bfc-b233-94a3d3377c95@intel.com>
Date: Thu, 13 Jun 2024 15:13:46 -0700
From: "Nambiar, Amritha" <amritha.nambiar@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
	<hawk@...nel.org>, <sridhar.samudrala@...el.com>, <alardam@...il.com>,
	<lorenzo@...nel.org>, <memxor@...il.com>
Subject: Re: [PATCH net] netdev-genl: fix error codes when outputting XDP
 features

On 6/13/2024 2:30 PM, Jakub Kicinski wrote:
> -EINVAL will interrupt the dump. The correct error to return
> if we have more data to dump is -EMSGSIZE.
> 
> Discovered by doing:
> 
>    for i in `seq 80`; do ip link add type veth; done
>    ./cli.py --dbg-small-recv 5300 --spec netdev.yaml --dump dev-get >> /dev/null
>    [...]
>       nl_len = 64 (48) nl_flags = 0x0 nl_type = 19
>       nl_len = 20 (4) nl_flags = 0x2 nl_type = 3
>    	error: -22
> 
> Fixes: d3d854fd6a1d ("netdev-genl: create a simple family for netdev stuff")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>

LGTM.
Reviewed-by: Amritha Nambiar <amritha.nambiar@...el.com>

> ---
> CC: hawk@...nel.org
> CC: amritha.nambiar@...el.com
> CC: sridhar.samudrala@...el.com
> CC: alardam@...il.com
> CC: lorenzo@...nel.org
> CC: memxor@...il.com
> ---
>   net/core/netdev-genl.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index 1f6ae6379e0f..05f9515d2c05 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -59,22 +59,22 @@ XDP_METADATA_KFUNC_xxx
>   	    nla_put_u64_64bit(rsp, NETDEV_A_DEV_XDP_RX_METADATA_FEATURES,
>   			      xdp_rx_meta, NETDEV_A_DEV_PAD) ||
>   	    nla_put_u64_64bit(rsp, NETDEV_A_DEV_XSK_FEATURES,
> -			      xsk_features, NETDEV_A_DEV_PAD)) {
> -		genlmsg_cancel(rsp, hdr);
> -		return -EINVAL;
> -	}
> +			      xsk_features, NETDEV_A_DEV_PAD))
> +		goto err_cancel_msg;
>   
>   	if (netdev->xdp_features & NETDEV_XDP_ACT_XSK_ZEROCOPY) {
>   		if (nla_put_u32(rsp, NETDEV_A_DEV_XDP_ZC_MAX_SEGS,
> -				netdev->xdp_zc_max_segs)) {
> -			genlmsg_cancel(rsp, hdr);
> -			return -EINVAL;
> -		}
> +				netdev->xdp_zc_max_segs))
> +			goto err_cancel_msg;
>   	}
>   
>   	genlmsg_end(rsp, hdr);
>   
>   	return 0;
> +
> +err_cancel_msg:
> +	genlmsg_cancel(rsp, hdr);
> +	return -EMSGSIZE;
>   }
>   
>   static void

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ