History

drm/self_refresh: Fix possible NULL deref in failure path

If state allocation fails, we still try to give back the reference on it. Also initialize ret in case the crtc is not enabled and we hit the eject button.

Sean Paul committed 7 years ago

Commit 002c8451 parent 7d0ed301 file · +4 −2Browse files

Unified · Split

drivers/gpu/drm/drm_self_refresh_helper.c+4−2
@@ -69,14 +69,14 @@ static void drm_self_refresh_helper_entry_work(struct work_struct *work) · 68 unmodified lines
6969 struct drm_connector *conn;
7070 struct drm_connector_state *conn_state;
7171 struct drm_crtc_state *crtc_state;
72− int i, ret;
72+ int i, ret = 0;
7373
7474 drm_modeset_acquire_init(&ctx, 0);
7575
7676 state = drm_atomic_state_alloc(dev);
7777 if (!state) {
7878 ret = -ENOMEM;
79− goto out;
79+ goto out_drop_locks;
8080 }
8181
8282 retry:
@@ -116,6 +116,8 @@ out: · 33 unmodified lines
116116 }
117117
118118 drm_atomic_state_put(state);
119+
120+out_drop_locks:
119121 drm_modeset_drop_locks(&ctx);
120122 drm_modeset_acquire_fini(&ctx);
121123 }