All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net v2] ice: validate VF FDIR queue and queue region actions
Date: Tue, 13 Oct 2026 14:58:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-169952@kernel.org> (raw)
In-Reply-To: <20261013144435.1406126-1-aleksandr.loktionov@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: memory leak of pkt_buf and prof in ice_vc_add_fdir_fltr error path
--

commit 6477a5eb13b0a0dff01249d4a775aff5939e63e5
Author: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

ice: validate VF FDIR queue and queue region actions

This commit validates the VF-supplied queue index and queue region in
ice_vc_fdir_parse_action(), rejecting invalid values to prevent a VF from
steering matched packets to queues beyond its own range.

> diff --git a/drivers/net/ethernet/intel/ice/virt/fdir.c b/drivers/net/ethernet/intel/ice/virt/fdir.c
> --- a/drivers/net/ethernet/intel/ice/virt/fdir.c
> +++ b/drivers/net/ethernet/intel/ice/virt/fdir.c
[ ... ]
> @@ -1176,11 +1181,25 @@ ice_vc_fdir_parse_action(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,
>  			break;
>  		case VIRTCHNL_ACTION_QUEUE:
>  			dest_num++;
> +			if (action->act_conf.queue.index >= vsi->num_rxq) {
> +				dev_dbg(dev, "Invalid queue index %u for VF %d\n",
> +					action->act_conf.queue.index, vf->vf_id);
> +				return -EINVAL;
> +			}

[Severity: High]
This problem wasn't introduced by this patch, but does returning here leak
memory if conf->pkt_buf and conf->prof were previously allocated?

In ice_vc_add_fdir_fltr(), if ice_vc_fdir_parse_action() fails, it jumps to
err_free_conf which frees the outer structure but not the inner ones:

ice_vc_add_fdir_fltr() {
    ...
    ret = ice_vc_fdir_parse_action(vf, fltr, conf);
    if (ret) {
        ...
        goto err_free_conf;
    }
    ...
err_free_conf:
    devm_kfree(dev, conf);
    ...
}

Earlier in the request handling, if this was a raw flow,
ice_vc_fdir_parse_raw() allocates pkt_buf and prof and assigns them to the
conf structure:

ice_vc_fdir_parse_raw() {
    ...
    pkt_buf = kzalloc(pkt_len, GFP_KERNEL);
    ...
    conf->pkt_buf = pkt_buf;
    ...
}

Could an untrusted VF exhaust host memory by repeatedly sending requests
with invalid queue parameters that trigger this return path?

>  			input->dest_ctl = ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX;
>  			input->q_index = action->act_conf.queue.index;
>  			break;
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013144435.1406126-1-aleksandr.loktionov@intel.com?part=1

      reply	other threads:[~2026-10-13 14:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 14:44 [PATCH iwl-net v2] ice: validate VF FDIR queue and queue region actions Aleksandr Loktionov
2026-10-13 14:58 ` sashiko-bot [this message]

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-169952@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.