public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: IGT development <igt-dev@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [igt-dev] [PATCH 7/7] drm/atomic: -EACCESS for lease-denied crtc lookup
Date: Thu, 28 Feb 2019 15:49:10 +0100	[thread overview]
Message-ID: <20190228144910.26488-8-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20190228144910.26488-1-daniel.vetter@ffwll.ch>

With the previous patch drm_crtc_find will return NULL when the crtc
isn't in our lease, which will then disable the plane/connector. No
longer an issue since the lessor can't escape their lease terms
anymore, but not quite great semantics yet either.

Catch this and return -EACCES, so that at least evil test cases have a
better chance of making sure the kernel works correctly.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index f0dbfeb00926..6687215cc188 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -539,6 +539,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 
 	} else if (property == config->prop_crtc_id) {
 		struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
+		if (val && !crtc)
+			return -EACCES;
 		return drm_atomic_set_crtc_for_plane(state, crtc);
 	} else if (property == config->prop_crtc_x) {
 		state->crtc_x = U642I64(val);
@@ -690,6 +692,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 
 	if (property == config->prop_crtc_id) {
 		struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
+		if (val && !crtc)
+			return -EACCES;
 		return drm_atomic_set_crtc_for_connector(state, crtc);
 	} else if (property == config->dpms_property) {
 		/* setting DPMS property requires special handling, which
-- 
2.14.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-02-28 14:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 14:49 [igt-dev] [PATCH 0/7] some cleanups and uapi clarification for leases Daniel Vetter
2019-02-28 14:49 ` [igt-dev] [PATCH 1/7] drm/leases: Drop object_id validation for negative ids Daniel Vetter
2019-03-14  7:54   ` Boris Brezillon
2019-03-29  4:46     ` Dave Airlie
2019-03-29  8:28       ` Daniel Vetter
2019-02-28 14:49 ` [igt-dev] [PATCH 2/7] drm/lease: Drop recursive leads checks Daniel Vetter
2019-03-14  8:44   ` Boris Brezillon
2019-02-28 14:49 ` [igt-dev] [PATCH 3/7] drm/leases: Don't init to 0 in drm_master_create Daniel Vetter
2019-03-14  7:56   ` Boris Brezillon
2019-03-29  4:47     ` Dave Airlie
2019-02-28 14:49 ` [igt-dev] [PATCH 4/7] drm/lease: Check for lessor outside of locks Daniel Vetter
2019-03-14  8:07   ` Boris Brezillon
2019-04-03  1:33     ` Dave Airlie
2019-04-03  7:04     ` Daniel Vetter
2019-04-03  7:50       ` Boris Brezillon
2019-02-28 14:49 ` [igt-dev] [PATCH 5/7] drm/lease: Make sure implicit planes are leased Daniel Vetter
2019-03-05 13:35   ` Sasha Levin
2019-02-28 14:49 ` [igt-dev] [PATCH 6/7] drm/atomic: Wire file_priv through for property changes Daniel Vetter
2019-02-28 14:49 ` Daniel Vetter [this message]
2019-03-14  8:58 ` [igt-dev] [PATCH 0/7] some cleanups and uapi clarification for leases Boris Brezillon
2019-04-05  2:40   ` Dave Airlie
2019-04-24  9:31     ` Daniel Vetter

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=20190228144910.26488-8-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=igt-dev@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