Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Przemek Kitszel" <przemyslaw.kitszel@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net-next v2 08/14] iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1
Date: Sat, 10 Oct 2026 12:16:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-166503@kernel.org> (raw)
In-Reply-To: <20261009121433.30347-9-przemyslaw.kitszel@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: iavf: missing bounds check on num_vsis causes out-of-bounds write
--

commit 96fe4c02ff0c0cd29e48e38845a6fbbedd204284
Author: Przemek Kitszel <przemyslaw.kitszel@intel.com>

iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1

Rename IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1, in preparation for
the next patch that will extend the max to 256, using old value of 16 for
the "v1" variant of virtchnl opcodes.

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> @@ -268,19 +268,19 @@ int iavf_send_vf_ptp_caps_msg(struct iavf_adapter *adapter)
>   **/
>  static void iavf_validate_num_queues(struct iavf_adapter *adapter)
>  {
> -	if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) {
> +	if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES_VCV1) {
>  		struct virtchnl_vsi_resource *vsi_res;
>  		int i;
>  
>  		dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n",
>  			 adapter->vf_res->num_queue_pairs,
> -			 IAVF_MAX_REQ_QUEUES);
> +			 IAVF_MAX_REQ_QUEUES_VCV1);
>  		dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n",
> -			 IAVF_MAX_REQ_QUEUES);
> -		adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES;
> +			 IAVF_MAX_REQ_QUEUES_VCV1);
> +		adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES_VCV1;
>  		for (i = 0; i < adapter->vf_res->num_vsis; i++) {
>  			vsi_res = &adapter->vf_res->vsi_res[i];
> -			vsi_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES;
> +			vsi_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES_VCV1;

[Severity: High]
Can a maliciously large num_vsis value from the PF cause an out-of-bounds
write here?

In iavf_get_vf_config(), the message from the PF is copied into
adapter->vf_res without validating num_vsis against the allocation
size:

	memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len));

	/* some PFs send more queues than we should have so validate that
	 * we aren't getting too many queues
	 */
	if (!err)
		iavf_validate_num_queues(adapter);

When iavf_validate_num_queues() runs, if the PF sent a num_queue_pairs
value greater than 16, this loop will iterate from 0 up to the unvalidated
adapter->vf_res->num_vsis.

If num_vsis exceeds the allocated size, this assignment writes the value 16
repeatedly into adjacent out-of-bounds heap memory. In confidential computing
environments, could a malicious PF use this to corrupt the VF kernel memory?

It does not appear that a bounds check is added in subsequent patches in
this series.

>  		}
>  	}
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009121433.30347-1-przemyslaw.kitszel@intel.com?part=8

  reply	other threads:[~2026-10-10 12:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 12:04 [PATCH net-next v2 00/14] devlink, mlx5, iavf, ice: XLVF for iavf Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 01/14] devlink, mlx5: add init/fini ops for shared devlink Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 02/14] ice: use shared devlink to store ice_adapters instead of custom xarray Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot
2026-10-13 12:57     ` Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 03/14] ice: add VF queue ena/dis helper functions Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 04/14] ice: add helpers for Global RSS LUT alloc, free, vsi_update Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 05/14] ice: rename ICE_MAX_RSS_QS_PER_VF to ICE_MAX_QS_PER_VF_VCV1 Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 06/14] ice: bump to 256qs for VF Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot
2026-10-13 13:46     ` Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 07/14] iavf: extend iavf_configure_queues() to support more queues Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 08/14] iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1 Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot [this message]
2026-10-13 13:27     ` Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 09/14] iavf: increase max number of queues to 256 Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 10/14] iavf: use new opcodes to request more than 16 queues Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot
2026-10-09 12:04 ` [PATCH net-next v2 11/14] ice: introduce handling of virtchnl LARGE VF opcodes Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 12/14] devlink: give user option to allocate resources Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 13/14] ice: represent RSS LUTs as devlink resources Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot
2026-10-13 13:49     ` Przemek Kitszel
2026-10-09 12:04 ` [PATCH net-next v2 14/14] ice: support up to 256 VF queues Przemek Kitszel
2026-10-10 12:16   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-166503@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox