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: <48867b62-bb26-5efa-e04b-696a0f2065b9@nvidia.com>
Date:   Thu, 12 Jan 2023 09:18:00 +0200
From:   Tariq Toukan <tariqt@...dia.com>
To:     Dan Carpenter <error27@...il.com>, oe-kbuild@...ts.linux.dev,
        Maxim Mikityanskiy <maximmi@...dia.com>
Cc:     lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Saeed Mahameed <saeedm@...dia.com>,
        Tariq Toukan <ttoukan.linux@...il.com>,
        "Adham Faris afaris"@nvidia.com, "Gal Pressman gal"@nvidia.com
Subject: Re: drivers/net/ethernet/mellanox/mlx5/core/en/params.c:481
 mlx5e_mpwrq_validate_xsk() error: we previously assumed 'xsk' could be null
 (see line 478)



On 10/01/2023 7:10, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   1fe4fd6f5cad346e598593af36caeadc4f5d4fa9
> commit: 6470d2e7e8ed8e9dd560d8dc3e09d1100a17ee26 net/mlx5e: xsk: Use KSM for unaligned XSK
> config: i386-randconfig-m021-20230102
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <error27@...il.com>
> 
> New smatch warnings:
> drivers/net/ethernet/mellanox/mlx5/core/en/params.c:481 mlx5e_mpwrq_validate_xsk() error: we previously assumed 'xsk' could be null (see line 478)
> 
> Old smatch warnings:
> drivers/net/ethernet/mellanox/mlx5/core/en/params.c:314 mlx5e_mpwqe_get_log_num_strides() warn: signedness bug returning '(-255)'
> 
> vim +/xsk +481 drivers/net/ethernet/mellanox/mlx5/core/en/params.c
> 
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  474  int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *params,
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  475  			     struct mlx5e_xsk_param *xsk)
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  476  {
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  477  	u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);
> 6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29 @478  	bool unaligned = xsk ? xsk->unaligned : false;
>                                                                           ^^^
> Assumes xsk can be NULL
> 
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  479  	u16 max_mtu_pkts;
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  480
> 6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29 @481  	if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, xsk->unaligned))
>                                                                                                                        ^^^^^
> Unchecked dereference
> 
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  482  		return -EOPNOTSUPP;
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  483
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  484  	if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, xsk))
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  485  		return -EINVAL;
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  486
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  487  	/* Current RQ length is too big for the given frame size, the
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  488  	 * needed number of WQEs exceeds the maximum.
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  489  	 */
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  490  	max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,
> 6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29  491  			     mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, unaligned));
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  492  	if (params->log_rq_mtu_frames > max_mtu_pkts) {
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  493  		mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  494  			      1 << params->log_rq_mtu_frames, xsk->chunk_size);
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  495  		return -EINVAL;
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  496  	}
> e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29  497
> 44f4fd03b51705 Maxim Mikityanskiy 2022-09-27  498  	return 0;
> b3a131c2a1602e Tariq Toukan       2021-03-07  499  }
> 
Hi,

Thanks for your report.
My team is looking into it and we'll reply/fix soon.

Regards,
Tariq

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ