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:   Fri, 30 Sep 2022 14:01:34 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Praghadeesh T K S <praghadeeshthevendria@...il.com>
Cc:     Boris Pismenny <borisp@...dia.com>,
        Saeed Mahameed <saeedm@...dia.com>,
        Leon Romanovsky <leon@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
        praghadeeshtks@...omail.in,
        linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] net: ethernet/mellanox: fix dereference before null check

On Fri, Sep 30, 2022 at 05:13:35PM +0530, Praghadeesh T K S wrote:
> net: ethernet/mellanox: fix dereference before null check
> macsec dereferenced before null check
> bug identified by coverity's linux-next weekly scan
> Coverity CID No: 1525317
> 
> Signed-off-by: Praghadeesh T K S <praghadeeshthevendria@...il.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> index 5da746d..e822c2a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> @@ -1846,11 +1846,11 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv)
>  void mlx5e_macsec_cleanup(struct mlx5e_priv *priv)
>  {
>  	struct mlx5e_macsec *macsec = priv->macsec;
> -	struct mlx5_core_dev *mdev = macsec->mdev;
>  
>  	if (!macsec)
>  		return;
>  
> +	struct mlx5_core_dev *mdev = macsec->mdev;
>  	mlx5_notifier_unregister(mdev, &macsec->nb);
>  
>  	mlx5e_macsec_fs_cleanup(macsec->macsec_fs);

Always test-build your changes before you get a grumpy maintainer asking
why you didn't test-build your changes...

Also, the original code is just fine, Coverity is wrong here, don't you
think?  Look at the output of what the code is doing please...

thanks,

greg k-h

Powered by blists - more mailing lists