Skip to contentSkip to conversation

drm/atomic: fix null pointer access to mode_fixup callback

PATCH Applied Inki Dae 2 participants 2 messages Aug 11, 2015

Subsystems (2)
lore
Share & tools
lore

Inki Dae

author
#0 lore raw

PATCH v2 1/1 drm/atomic: fix null pointer access to mode_fixup callback

This patch fixes null pointer access incurred when encoder driver didn't set its own mode_fixup callback.

mode_fixup callback shoudn't be called if the callback of drm_encoder_helper_funcs is NULL.

Changelog v2:
- change it to else if

---
 drivers/gpu/drm/drm_atomic_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
index 5b59d5ad..c25bacb 100644
@@ -298,7 +298,7 @@ mode_fixup(struct drm_atomic_state *state)
 						 encoder->base.id, encoder->name);
 				return ret;
 			}
-		} else {
+		} else if (funcs->mode_fixup) {
 			ret = funcs->mode_fixup(encoder, &crtc_state->mode,
 						&crtc_state->adjusted_mode);
 			if (!ret) {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 11 lines · Inki Dae

This patch fixes null pointer access incurred when encoder driver didn't set its own mode_fixup callback.

mode_fixup callback shoudn't be called if the callback of drm_encoder_helper_funcs is NULL.

Changelog v2:
- change it to else if

Applied to drm-misc, thanks.
-Daniel

Quoted 20 lines
---
 drivers/gpu/drm/drm_atomic_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
index 5b59d5ad..c25bacb 100644
@@ -298,7 +298,7 @@ mode_fixup(struct drm_atomic_state *state)
 						 encoder->base.id, encoder->name);
 				return ret;
 			}
-		} else {
+		} else if (funcs->mode_fixup) {
 			ret = funcs->mode_fixup(encoder, &crtc_state->mode,
 						&crtc_state->adjusted_mode);
 			if (!ret) {
Signature · 1 line
1.9.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel