All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 3/7] drm/lease: Add a helper to tell whether a lease was revoked
Date: Fri, 06 Nov 2026 15:24:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-201688@kernel.org> (raw)
In-Reply-To: <20261106-drm-reset-state-flag-v8-3-50fd046b705f@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/lease: false revocation report for empty leases in
  drm_lease_revoked()
--

commit 15b02cb8a3b3d4a5372c96b45134239f8d815a69
Author: Maxime Ripard <mripard@kernel.org>

drm/lease: Add a helper to tell whether a lease was revoked

This commit adds drm_lease_revoked() to check whether a drm_file's lease
has been revoked by testing if its master->leases IDR is empty.

> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index 5d2cf724cbd7b..dd59df14dcc02 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -147,6 +147,32 @@ bool drm_lease_held(struct drm_file *file_priv, int id)
>  	return ret;
>  }
>  
> +/*
> + * Checks whether the file is a lessee whose lease has been revoked. A
> + * lease is always revoked as a whole, so an empty one has been revoked.
> + */
> +bool drm_lease_revoked(struct drm_file *file_priv)
> +{
> +	struct drm_master *master;
> +	bool ret = false;
> +
> +	if (!file_priv)
> +		return false;
> +
> +	master = drm_file_get_master(file_priv);
> +	if (!master)
> +		return false;
> +
> +	if (master->lessor) {
> +		mutex_lock(&master->dev->mode_config.idr_mutex);
> +		ret = idr_is_empty(&master->leases);
> +		mutex_unlock(&master->dev->mode_config.idr_mutex);
> +	}

[Severity: Medium]
Does drm_lease_revoked() falsely report valid empty leases as revoked?

Since 4bb2d367a5a2 ("drm/lease: allow empty leases"),
drm_mode_create_lease_ioctl() permits creating a lease with
object_count == 0, which leaves master->leases empty from creation.
Callers of drm_lease_revoked() will treat any such unrevoked empty lease
as revoked.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-drm-reset-state-flag-v8-0-50fd046b705f@kernel.org?part=3

  reply	other threads:[~2026-11-06 15:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 15:11 [PATCH v8 0/7] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-06 15:11 ` [PATCH v8 1/7] drm/amd/display: Fix planes atomic_create_state implementation Maxime Ripard
2026-11-06 15:11 ` [PATCH v8 2/7] drm/atomic: Add drm_atomic_implements_create_state() helper Maxime Ripard
2026-11-06 15:11 ` [PATCH v8 3/7] drm/lease: Add a helper to tell whether a lease was revoked Maxime Ripard
2026-11-06 15:24   ` sashiko-bot [this message]
2026-11-06 15:11 ` [PATCH v8 4/7] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-11-06 15:38   ` sashiko-bot
2026-11-06 15:11 ` [PATCH v8 5/7] drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() Maxime Ripard
2026-11-06 15:20   ` sashiko-bot
2026-11-06 15:11 ` [PATCH v8 6/7] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-11-06 15:37   ` sashiko-bot
2026-11-06 15:11 ` [PATCH v8 7/7] drm/vkms: Add driver-specific plane property for testing Maxime Ripard
2026-11-07 12:16   ` Oarora Etimis

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-201688@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mripard@kernel.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.