Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v5 3/6] drm/xe/vf: Add bounds checking for queried context and doorbell counts
Date: Tue, 11 Aug 2026 11:04:43 +0200	[thread overview]
Message-ID: <554f0ebd-2689-4918-95a6-816881edcd1a@intel.com> (raw)
In-Reply-To: <20260810101428.1009573-11-satyanarayana.k.v.p@intel.com>



On 8/10/2026 12:14 PM, Satyanarayana K V P wrote:
> Add explicit bounds checks for context and doorbells which can detect
> and reject invalid configuration data from a misconfigured or
> malfunctioning PF, preventing protocol violations and protecting VF
> initialization.
> 
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

> ---
> V4 -> V5:
> - Fixed review comments (Michal W).
> 
> V3 -> V4:
>  - New commit
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 339ea0d3344c..81d68fe5ad7c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> @@ -15,6 +15,7 @@
>  #include "abi/guc_klvs_abi.h"
>  #include "abi/guc_relay_actions_abi.h"
>  #include "regs/xe_gt_regs.h"
> +#include "regs/xe_guc_regs.h"
>  
>  #include "xe_assert.h"
>  #include "xe_device.h"
> @@ -581,6 +582,11 @@ static int vf_get_ctxs_cfg(struct xe_gt *gt)
>  	if (unlikely(err))
>  		return err;
>  
> +	if (num_ctxs > GUC_ID_MAX) {
> +		xe_gt_sriov_err(gt, "Out of bound CTXs %u received\n", num_ctxs);
> +		return -EPROTO;
> +	}
> +
>  	if (config->num_ctxs && config->num_ctxs != num_ctxs) {
>  		xe_gt_sriov_err(gt, "Unexpected CTXs reassignment: %u != %u\n",
>  				num_ctxs, config->num_ctxs);
> @@ -607,6 +613,11 @@ static int vf_get_dbs_cfg(struct xe_gt *gt)
>  	if (unlikely(err))
>  		return err;
>  
> +	if (num_dbs > GUC_NUM_DOORBELLS) {
> +		xe_gt_sriov_err(gt, "Out of bound DBs %u received\n", num_dbs);
> +		return -EPROTO;
> +	}
> +
>  	if (config->num_dbs && config->num_dbs != num_dbs) {
>  		xe_gt_sriov_err(gt, "Unexpected DBs reassignment: %u != %u\n",
>  				num_dbs, config->num_dbs);


  reply	other threads:[~2026-08-11  9:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 10:14 [PATCH v5 0/6] KUnit test for VF provisioning error handling Satyanarayana K V P
2026-08-10 10:14 ` [PATCH v5 1/6] drm/xe/guc: Allow to replace xe_guc_mmio_send_recv() with KUNIT stub Satyanarayana K V P
2026-08-11  8:54   ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 2/6] drm/xe/vf: Split submission config query helpers Satyanarayana K V P
2026-08-11  9:02   ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 3/6] drm/xe/vf: Add bounds checking for queried context and doorbell counts Satyanarayana K V P
2026-08-11  9:04   ` Michal Wajdeczko [this message]
2026-08-10 10:14 ` [PATCH v5 4/6] drm/xe/vf: Add bounds checking for queried GGTT base and size Satyanarayana K V P
2026-08-11  9:43   ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 5/6] drm/xe/vf: Add bounds checking for queried VRAM size Satyanarayana K V P
2026-08-11  9:48   ` Michal Wajdeczko
2026-08-10 10:14 ` [PATCH v5 6/6] drm/xe/tests: Add KUnit tests for VF provisioning error handling Satyanarayana K V P
2026-08-11 10:12   ` Michal Wajdeczko
2026-08-10 10:18 ` ✗ CI.checkpatch: warning for KUnit test for VF provisioning error handling (rev5) Patchwork
2026-08-10 10:19 ` ✓ CI.KUnit: success " Patchwork
2026-08-10 11:01 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-10 13:16 ` ✗ Xe.CI.FULL: failure " Patchwork

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=554f0ebd-2689-4918-95a6-816881edcd1a@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=satyanarayana.k.v.p@intel.com \
    /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