Skip to content

Commit 439cf34

Browse files
committed
drm/atomic: Don't pollute crtc_state->mode_blob with error pointers
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()). Cc: stable@vger.kernel.org Reported-by: fuyufan <fuyufan@huawei.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220209091928.14766-1-ville.syrjala@linux.intel.com Acked-by: Maxime Ripard <maxime@cerno.tech>
1 parent 59f39bf commit 439cf34

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

drivers/gpu/drm/drm_atomic_uapi.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
7676
state->mode_blob = NULL;
7777

7878
if (mode) {
79+
struct drm_property_blob *blob;
80+
7981
drm_mode_convert_to_umode(&umode, mode);
80-
state->mode_blob =
81-
drm_property_create_blob(state->crtc->dev,
82-
sizeof(umode),
83-
&umode);
84-
if (IS_ERR(state->mode_blob))
85-
return PTR_ERR(state->mode_blob);
82+
blob = drm_property_create_blob(crtc->dev,
83+
sizeof(umode), &umode);
84+
if (IS_ERR(blob))
85+
return PTR_ERR(blob);
8686

8787
drm_mode_copy(&state->mode, mode);
88+
89+
state->mode_blob = blob;
8890
state->enable = true;
8991
drm_dbg_atomic(crtc->dev,
9092
"Set [MODE:%s] for [CRTC:%d:%s] state %p\n",

0 commit comments

Comments
 (0)