Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 1/2] drm/xe: Fix possible exec queue leak in exec IOCTL
Date: Mon,  4 Nov 2024 20:35:23 -0800	[thread overview]
Message-ID: <20241105043524.4062774-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20241105043524.4062774-1-matthew.brost@intel.com>

In a couple of places after an exec queue is looked up the exec IOCTL
returns on input errors without dropping the exec queue ref. Fix this
ensuring the exec queue ref is dropped on input error.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: stable <stable@kernel.org>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_exec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index f23ac1e2ed88..6de12f91b865 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -132,12 +132,16 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 	if (XE_IOCTL_DBG(xe, !q))
 		return -ENOENT;
 
-	if (XE_IOCTL_DBG(xe, q->flags & EXEC_QUEUE_FLAG_VM))
-		return -EINVAL;
+	if (XE_IOCTL_DBG(xe, q->flags & EXEC_QUEUE_FLAG_VM)) {
+		err = -EINVAL;
+		goto err_exec_queue;
+	}
 
 	if (XE_IOCTL_DBG(xe, args->num_batch_buffer &&
-			 q->width != args->num_batch_buffer))
-		return -EINVAL;
+			 q->width != args->num_batch_buffer)) {
+		err = -EINVAL;
+		goto err_exec_queue;
+	}
 
 	if (XE_IOCTL_DBG(xe, q->ops->reset_status(q))) {
 		err = -ECANCELED;
-- 
2.34.1


  reply	other threads:[~2024-11-05  4:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05  4:35 [PATCH 0/2] A couple exec IOCTL fixes Matthew Brost
2024-11-05  4:35 ` Matthew Brost [this message]
2024-11-05  6:48   ` [PATCH 1/2] drm/xe: Fix possible exec queue leak in exec IOCTL Upadhyay, Tejas
2024-11-05 20:52   ` Lucas De Marchi
2024-11-05  4:35 ` [PATCH 2/2] drm/xe: Drop VM dma-resv lock on xe_sync_in_fence_get failure " Matthew Brost
2024-11-05  6:47   ` Upadhyay, Tejas
2024-11-05 20:55   ` Lucas De Marchi
2024-11-05  4:40 ` ✓ CI.Patch_applied: success for A couple exec IOCTL fixes (rev2) Patchwork
2024-11-05  4:40 ` ✗ CI.checkpatch: warning " Patchwork
2024-11-05  4:42 ` ✓ CI.KUnit: success " Patchwork
2024-11-05  4:53 ` ✓ CI.Build: " Patchwork
2024-11-05  4:55 ` ✓ CI.Hooks: " Patchwork
2024-11-05  4:57 ` ✓ CI.checksparse: " Patchwork
2024-11-05  5:20 ` ✓ CI.BAT: " Patchwork
2024-11-06  3:14 ` ✗ CI.FULL: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-11-05  0:38 [PATCH 0/2] A couple exec IOCTL fixes Matthew Brost
2024-11-05  0:38 ` [PATCH 1/2] drm/xe: Fix possible exec queue leak in exec IOCTL Matthew Brost
2024-11-05  2:44   ` Rodrigo Vivi
2024-11-05  4:45     ` Matthew Brost

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=20241105043524.4062774-2-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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