Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 1/2] drm/atomic: Don't pollute crtc_state->mode_blob with error pointers
@ 2022-02-09  9:19 Ville Syrjala
  2022-02-09  9:19 ` [Intel-gfx] [PATCH 2/2] drm/modes: Fix drm_mode_copy() docs Ville Syrjala
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ville Syrjala @ 2022-02-09  9:19 UTC (permalink / raw)
  To: dri-devel; +Cc: fuyufan, intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make sure we don't assign an error pointer to crtc_state->mode_blob
as that will break all kinds of places that assume either NULL or a
valid pointer (eg. drm_property_blob_put()).

Reported-by: fuyufan <fuyufan@huawei.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 9781722519c3..54d62fdb4ef9 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
 	state->mode_blob = NULL;
 
 	if (mode) {
+		struct drm_property_blob *blob;
+
 		drm_mode_convert_to_umode(&umode, mode);
-		state->mode_blob =
-			drm_property_create_blob(state->crtc->dev,
-						 sizeof(umode),
-						 &umode);
-		if (IS_ERR(state->mode_blob))
-			return PTR_ERR(state->mode_blob);
+		blob = drm_property_create_blob(crtc->dev,
+						sizeof(umode), &umode);
+		if (IS_ERR(blob))
+			return PTR_ERR(blob);
 
 		drm_mode_copy(&state->mode, mode);
+
+		state->mode_blob = blob;
 		state->enable = true;
 		drm_dbg_atomic(crtc->dev,
 			       "Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-16 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09  9:19 [Intel-gfx] [PATCH 1/2] drm/atomic: Don't pollute crtc_state->mode_blob with error pointers Ville Syrjala
2022-02-09  9:19 ` [Intel-gfx] [PATCH 2/2] drm/modes: Fix drm_mode_copy() docs Ville Syrjala
2022-02-09 10:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/2] drm/atomic: Don't pollute crtc_state->mode_blob with error pointers Patchwork
2022-02-09 11:24 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-16 11:19 ` [Intel-gfx] [PATCH 1/2] " Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox