[PATCH 1/2] drm/xe: Fix possible exec queue leak in exec IOCTL
Upadhyay, Tejas
tejas.upadhyay at intel.com
Tue Nov 5 06:48:06 UTC 2024
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of
> Matthew Brost
> Sent: Tuesday, November 5, 2024 10:05 AM
> To: intel-xe at lists.freedesktop.org
> Subject: [PATCH 1/2] drm/xe: Fix possible exec queue leak in exec IOCTL
>
> 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 at kernel.org>
> Signed-off-by: Matthew Brost <matthew.brost at 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;
> + }
LGTM,
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
>
> if (XE_IOCTL_DBG(xe, q->ops->reset_status(q))) {
> err = -ECANCELED;
> --
> 2.34.1
More information about the Intel-xe
mailing list