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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240416143626.GR2320920@kernel.org>
Date: Tue, 16 Apr 2024 15:36:26 +0100
From: Simon Horman <horms@...nel.org>
To: Petr Machata <petrm@...dia.com>
Cc: "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, Ido Schimmel <idosch@...dia.com>,
	mlxsw@...dia.com, Tim 'mithro' Ansell <me@...h.ro>
Subject: Re: [PATCH net 2/3] mlxsw: core_env: Fix driver initialization with
 old firmware

On Tue, Apr 16, 2024 at 12:24:15PM +0200, Petr Machata wrote:
> From: Ido Schimmel <idosch@...dia.com>
> 
> The driver queries the Management Capabilities Mask (MCAM) register
> during initialization to understand if it can read up to 128 bytes from
> transceiver modules.
> 
> However, not all firmware versions support this register, leading to the
> driver failing to load.
> 
> Fix by treating an error in the register query as an indication that the
> feature is not supported.
> 
> Fixes: 1f4aea1f72da ("mlxsw: core_env: Read transceiver module EEPROM in 128 bytes chunks")
> Reported-by: Tim 'mithro' Ansell <me@...h.ro>
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> Reviewed-by: Petr Machata <petrm@...dia.com>
> Signed-off-by: Petr Machata <petrm@...dia.com>
> ---
>  drivers/net/ethernet/mellanox/mlxsw/core_env.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
> index 53b150b7ae4e..5d02b6aef4d2 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
> @@ -1360,17 +1360,15 @@ static struct mlxsw_linecards_event_ops mlxsw_env_event_ops = {
>  static int mlxsw_env_max_module_eeprom_len_query(struct mlxsw_env *mlxsw_env)
>  {
>  	char mcam_pl[MLXSW_REG_MCAM_LEN];
> -	bool mcia_128b_supported;
> +	bool mcia_128b_supported = false;
>  	int err;
>  
>  	mlxsw_reg_mcam_pack(mcam_pl,
>  			    MLXSW_REG_MCAM_FEATURE_GROUP_ENHANCED_FEATURES);
>  	err = mlxsw_reg_query(mlxsw_env->core, MLXSW_REG(mcam), mcam_pl);
> -	if (err)
> -		return err;
> -
> -	mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_MCIA_128B,
> -			      &mcia_128b_supported);
> +	if (!err)
> +		mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_MCIA_128B,
> +				      &mcia_128b_supported);
>  
>  	mlxsw_env->max_eeprom_len = mcia_128b_supported ? 128 : 48;

Hi Petr and Ido,

This function now always returns 0.
Perhaps the return type can be updated to void?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ