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:   Wed, 24 Feb 2021 01:32:51 +0100
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Simon Horman <simon.horman@...ronome.com>
Cc:     David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        oss-drivers@...ronome.com,
        Yinjun Zhang <yinjun.zhang@...igine.com>,
        Louis Peens <louis.peens@...ronome.com>
Subject: Re: [PATCH net] ethtool: fix the check logic of at least one channel
 for RX/TX

On Tue, Feb 23, 2021 at 02:24:40PM +0100, Simon Horman wrote:
> From: Yinjun Zhang <yinjun.zhang@...igine.com>
> 
> The command "ethtool -L <intf> combined 0" may clean the RX/TX channel
> count and skip the error path, since the attrs
> tb[ETHTOOL_A_CHANNELS_RX_COUNT] and tb[ETHTOOL_A_CHANNELS_TX_COUNT]
> are NULL in this case when recent ethtool is used.
> 
> Tested using ethtool v5.10.
> 
> Fixes: 7be92514b99c ("ethtool: check if there is at least one channel for TX/RX in the core")
> Signed-off-by: Yinjun Zhang <yinjun.zhang@...igine.com>
> Signed-off-by: Simon Horman <simon.horman@...ronome.com>
> Signed-off-by: Louis Peens <louis.peens@...ronome.com>

Reviewed-by: Michal Kubecek <mkubecek@...e.cz>

> ---
>  net/ethtool/channels.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ethtool/channels.c b/net/ethtool/channels.c
> index 25a9e566ef5c..e35ef627f61f 100644
> --- a/net/ethtool/channels.c
> +++ b/net/ethtool/channels.c
> @@ -175,14 +175,14 @@ int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info)
>  
>  	/* ensure there is at least one RX and one TX channel */
>  	if (!channels.combined_count && !channels.rx_count)
> -		err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT];
> +		err_attr = mod_combined ? tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT] :
> +					  tb[ETHTOOL_A_CHANNELS_RX_COUNT];
>  	else if (!channels.combined_count && !channels.tx_count)
> -		err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT];
> +		err_attr = mod_combined ? tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT] :
> +					  tb[ETHTOOL_A_CHANNELS_TX_COUNT];
>  	else
>  		err_attr = NULL;
>  	if (err_attr) {
> -		if (mod_combined)
> -			err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT];
>  		ret = -EINVAL;
>  		NL_SET_ERR_MSG_ATTR(info->extack, err_attr, "requested channel counts would result in no RX or TX channel being configured");
>  		goto out_ops;
> -- 
> 2.20.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ