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: <7e5d6d30-ed89-8a8e-55c1-a25897937727@mellanox.com>
Date:   Wed, 2 May 2018 16:31:24 +0300
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Tarick Bedeir <tarick@...gle.com>, tariqt@...lanox.com,
        gthelen@...gle.com, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/mlx4_core: Fix error handling in mlx4_init_port_info.



On 27/04/2018 6:20 PM, Tarick Bedeir wrote:
> Avoid exiting the function with a lingering sysfs file (if the first
> call to device_create_file() fails while the second succeeds), and avoid
> calling devlink_port_unregister() twice.
> 
> In other words, either mlx4_init_port_info() succeeds and returns zero, or
> it fails, returns non-zero, and requires no cleanup.
> 
> Signed-off-by: Tarick Bedeir <tarick@...gle.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/main.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> index 4d84cab77105..e8a3a45d0b53 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -3007,6 +3007,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
>   		mlx4_err(dev, "Failed to create file for port %d\n", port);
>   		devlink_port_unregister(&info->devlink_port);
>   		info->port = -1;
> +		return err;
>   	}
>   
>   	sprintf(info->dev_mtu_name, "mlx4_port%d_mtu", port);
> @@ -3028,9 +3029,10 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
>   				   &info->port_attr);
>   		devlink_port_unregister(&info->devlink_port);
>   		info->port = -1;
> +		return err;
>   	}
>   
> -	return err;
> +	return 0;
>   }
>   
>   static void mlx4_cleanup_port_info(struct mlx4_port_info *info)
> 
Acked-by: Tariq Toukan <tariqt@...lanox.com>

Thanks Tarick.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ