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: <3F057952-3C88-452F-BFC5-4DC2B87FAD67@nvidia.com>
Date:   Mon, 28 Sep 2020 18:31:04 +0000
From:   Ariel Levkovich <lariel@...dia.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
CC:     Saeed Mahameed <saeedm@...dia.com>,
        Leon Romanovsky <leon@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Roi Dayan <roid@...lanox.com>,
        Ariel Levkovich <lariel@...lanox.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH 1/2 net-next] net/mlx5e: TC: Fix IS_ERR() vs NULL checks

On Sep 28, 2020, at 13:42, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> 
> The mlx5_tc_ct_init() function doesn't return error pointers it returns
> NULL.  Also we need to set the error codes on this path.
> 
> Fixes: aedd133d17bc ("net/mlx5e: Support CT offload for tc nic flows")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 104b1c339de0..438fbcf478d1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -5224,8 +5224,10 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
> 
>    tc->ct = mlx5_tc_ct_init(priv, tc->chains, &priv->fs.tc.mod_hdr,
>                 MLX5_FLOW_NAMESPACE_KERNEL);
> -    if (IS_ERR(tc->ct))
> +    if (!tc->ct) {
> +        err = -ENOMEM;
>        goto err_ct;
> +    }

Hi Dan,
That was implement like that on purpose. If mlx5_tc_init_ct returns NULL it means the device doesn’t support CT offload which can happen with older devices or old FW on the devices.
However, in this case we want to continue with the rest of the Tc initialization because we can still support other TC offloads. No need to fail the entire TC init in this case. Only if mlx5_tc_init_ct return err_ptr that means the tc init failed not because of lack of support but due to a real error and only then we want to fail the rest of the tc init.

Your change will break compatibility for devices/FW versions that don’t have CT offload support.

Ariel

> 
>    tc->netdevice_nb.notifier_call = mlx5e_tc_netdev_event;
>    err = register_netdevice_notifier_dev_net(priv->netdev,
> @@ -5300,8 +5300,10 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
>                           esw_chains(esw),
>                           &esw->offloads.mod_hdr,
>                           MLX5_FLOW_NAMESPACE_FDB);
> -    if (IS_ERR(uplink_priv->ct_priv))
> +    if (!uplink_priv->ct_priv) {
> +        err = -ENOMEM;
>        goto err_ct;
> +    }
> 
>    mapping = mapping_create(sizeof(struct tunnel_match_key),
>                 TUNNEL_INFO_BITS_MASK, true);
> -- 
> 2.28.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ