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] [day] [month] [year] [list]
Message-ID: <99b3a1adc89828aa1a761774328e67b386b05611.camel@redhat.com>
Date:   Tue, 05 Sep 2023 10:33:46 +0200
From:   Paolo Abeni <pabeni@...hat.com>
To:     Chen Ni <nichen@...as.ac.cn>, borisp@...dia.com, saeedm@...dia.com,
        leon@...nel.org, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, sd@...asysnail.net, raeds@...dia.com,
        ehakim@...dia.com, liorna@...dia.com, phaddad@...dia.com,
        atenart@...nel.org
Cc:     netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/mlx5e: Add missing check for xa_load

On Mon, 2023-09-04 at 08:12 +0000, Chen Ni wrote:
> Add check for xa_load() in order to avoid NULL pointer
> dereference.
> 
> Fixes: b7c9400cbc48 ("net/mlx5e: Implement MACsec Rx data path using MACsec skb_metadata_dst")
> Signed-off-by: Chen Ni <nichen@...as.ac.cn>
> ---
>  .../net/ethernet/mellanox/mlx5/core/en_accel/macsec.c  | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> 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 c9c1db971652..d2467c0bc3c8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> @@ -1673,10 +1673,12 @@ void mlx5e_macsec_offload_handle_rx_skb(struct net_device *netdev,
>  
>  	rcu_read_lock();
>  	sc_xarray_element = xa_load(&macsec->sc_xarray, fs_id);
> -	rx_sc = sc_xarray_element->rx_sc;
> -	if (rx_sc) {
> -		dst_hold(&rx_sc->md_dst->dst);
> -		skb_dst_set(skb, &rx_sc->md_dst->dst);
> +	if (sc_xarray_element) {
> +		rx_sc = sc_xarray_element->rx_sc;
> +		if (rx_sc) {
> +			dst_hold(&rx_sc->md_dst->dst);
> +			skb_dst_set(skb, &rx_sc->md_dst->dst);
> +		}
>  	}
>  
>  	rcu_read_unlock();

@Saeed: I assume this will first go through your tree and then we will
get back via a later PR, right?

In any case Pavan's comment looks reasonable to me, @Chen: please
address it.

Cheers,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ