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  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:   Sun, 3 Mar 2019 14:12:18 +0000
From:   Roi Dayan <roid@...lanox.com>
To:     "xiangxia.m.yue@...il.com" <xiangxia.m.yue@...il.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        "gerlitz.or@...il.com" <gerlitz.or@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Mohamad Haj Yahia <mohamad@...lanox.com>
Subject: Re: [PATCH net 2/2] net/mlx5: Avoid panic when setting VF rate



On 03/03/2019 11:56, xiangxia.m.yue@...il.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@...il.com>
> 
> If we try to set VFs rate on a VF (not PF) net device, the kernel
> will be crash. The commands are show as below:
> 
> $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs
> $ ip link set $MLX_VF0 vf 0 rate 100

actually this didn't reproduce with this command + your first fix.

setting rate calls netlink IFLA_VF_TX_RATE which is calling
nfo_get_vf_config() which is now returning error correctly.

we need the netlink call to be IFLA_VF_RATE. seems we get there
when we set min/max_tx_rate.
so i reproduce the error with this command
$ ip link set dev $VF vf 0 max_tx_rate 2 max_tx_rate 1

can you verify and fix the commit msg?

> 
> Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate")
> Cc: Mohamad Haj Yahia <mohamad@...lanox.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> index 774edc9..8c2f1e6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> @@ -2122,19 +2122,24 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
>  int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
>  				u32 max_rate, u32 min_rate)
>  {
> -	u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
> -	bool min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
> -					fw_max_bw_share >= MLX5_MIN_BW_SHARE;
> -	bool max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);
>  	struct mlx5_vport *evport;
> +	u32 fw_max_bw_share;
>  	u32 previous_min_rate;
>  	u32 divider;
> +	bool min_rate_supported;
> +	bool max_rate_supported;
>  	int err = 0;
>  
>  	if (!ESW_ALLOWED(esw))
>  		return -EPERM;
>  	if (!LEGAL_VPORT(esw, vport))
>  		return -EINVAL;
> +
> +	fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
> +	min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
> +				fw_max_bw_share >= MLX5_MIN_BW_SHARE;
> +	max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);
> +
>  	if ((min_rate && !min_rate_supported) || (max_rate && !max_rate_supported))
>  		return -EOPNOTSUPP;
>  
> 

Powered by blists - more mailing lists