drm: Check for connector->state NULL in drm_atomic_add_affected_connectors
Subsystems (2)
PATCH 1/1 drm: Check for connector->state NULL in drm_atomic_add_affected_connectors
On a system I'm doing development on I found a crash. The crawl looked like:
PC is at drm_atomic_add_affected_connectors+0x98/0xe8
...
drm_atomic_add_affected_connectors from __drm_atomic_helper_set_config+0x218/0x344 __drm_atomic_helper_set_config from restore_fbdev_mode+0x108/0x250 restore_fbdev_mode from drm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80 drm_fb_helper_restore_fbdev_mode_unlocked from rockchip_drm_lastclose+0x1c/0x20 rockchip_drm_lastclose from drm_lastclose+0x4c/0x104
drm_lastclose from drm_release+0x424/0x47c
drm_release from __fput+0xf8/0x1d4
__fput from ____fput+0x18/0x1c
____fput from task_work_run+0xa8/0xbc
task_work_run from do_exit+0x448/0x91c
do_exit from do_group_exit+0x5c/0xcc
do_group_exit from get_signal+0x4dc/0x57c
get_signal from do_signal+0x9c/0x3b4
do_signal from do_work_pending+0x60/0xb8
do_work_pending from slow_work_pending+0xc/0x20
I found that I could fix the crash by checking connector->state against NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in.
--- drivers/gpu/drm/drm_atomic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +1 -1
@@ -1147,7 +1147,7 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,* current configuration. */ drm_for_each_connector (connector, state->dev) { -if (connector->state->crtc != crtc) +if (!connector->state || connector->state->crtc != crtc)continue ; conn_state =drm_atomic_get_connector_state (state, connector);
Signature · 1 line
2.7.0.rc3.207.g0ac5344
Quoted 21 lines · Douglas Anderson
On a system I'm doing development on I found a crash. The crawl looked like:
PC is at
drm_atomic_add_affected_connectors+0x98/0xe8
...
drm_atomic_add_affected_connectorsfrom__drm_atomic_helper_set_config+0x218/0x344__drm_atomic_helper_set_configfromrestore_fbdev_mode+0x108/0x250restore_fbdev_modefromdrm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80drm_fb_helper_restore_fbdev_mode_unlockedfromrockchip_drm_lastclose+0x1c/0x20rockchip_drm_lastclosefromdrm_lastclose+0x4c/0x104
drm_lastclosefromdrm_release+0x424/0x47c
drm_releasefrom__fput+0xf8/0x1d4
__fputfrom____fput+0x18/0x1c
____fputfromtask_work_run+0xa8/0xbc
task_work_runfromdo_exit+0x448/0x91c
do_exitfromdo_group_exit+0x5c/0xcc
do_group_exitfromget_signal+0x4dc/0x57c
get_signalfromdo_signal+0x9c/0x3b4
do_signalfromdo_work_pending+0x60/0xb8
do_work_pendingfromslow_work_pending+0xc/0x20
Quoted 7 lines
I found that I could fix the crash by checking
connector->stateagainst NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in.Signed-off-by Douglas Anderson <[email protected]>
This is a driver bug - under atomic the assumption is that there is _always_ a current software state. Most driver set up the initial "everything off" state in the ->reset functions.
-Daniel
Quoted 24 lines
--- drivers/gpu/drm/drm_atomic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +1
-1@@ -1147,7 +1147,7 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,* current configuration. */ drm_for_each_connector (connector, state->dev) { -if (connector->state->crtc != crtc) +if (!connector->state || connector->state->crtc != crtc)continue ; conn_state =drm_atomic_get_connector_state (state, connector);Signature · 6 lines
2.7.0.rc3.207.g0ac5344 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · Daniel Vetter
Quoted 27 lines · Douglas Anderson
On a system I'm doing development on I found a crash. The crawl looked like:
PC is at
drm_atomic_add_affected_connectors+0x98/0xe8
...
drm_atomic_add_affected_connectorsfrom__drm_atomic_helper_set_config+0x218/0x344__drm_atomic_helper_set_configfromrestore_fbdev_mode+0x108/0x250restore_fbdev_modefromdrm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80drm_fb_helper_restore_fbdev_mode_unlockedfromrockchip_drm_lastclose+0x1c/0x20rockchip_drm_lastclosefromdrm_lastclose+0x4c/0x104
drm_lastclosefromdrm_release+0x424/0x47c
drm_releasefrom__fput+0xf8/0x1d4
__fputfrom____fput+0x18/0x1c
____fputfromtask_work_run+0xa8/0xbc
task_work_runfromdo_exit+0x448/0x91c
do_exitfromdo_group_exit+0x5c/0xcc
do_group_exitfromget_signal+0x4dc/0x57c
get_signalfromdo_signal+0x9c/0x3b4
do_signalfromdo_work_pending+0x60/0xb8
do_work_pendingfromslow_work_pending+0xc/0x20I found that I could fix the crash by checking
connector->stateagainst NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in.
Quoted 5 lines
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>This is a driver bug - under atomic the assumption is that there is _always_ a current software state. Most driver set up the initial "everything off" state in the ->reset functions.
Except if it's due to kzalloc() failing in the atomic helper reset implementation. There's no way to propagate the error upwards, so the current implementation just silently sets state=NULL and goes on like nothing happened.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel,
Quoted 28 lines · Daniel Vetter
Quoted 27 lines · Douglas Anderson
On a system I'm doing development on I found a crash. The crawl looked like:
PC is at
drm_atomic_add_affected_connectors+0x98/0xe8
...
drm_atomic_add_affected_connectorsfrom__drm_atomic_helper_set_config+0x218/0x344__drm_atomic_helper_set_configfromrestore_fbdev_mode+0x108/0x250restore_fbdev_modefromdrm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80drm_fb_helper_restore_fbdev_mode_unlockedfromrockchip_drm_lastclose+0x1c/0x20rockchip_drm_lastclosefromdrm_lastclose+0x4c/0x104
drm_lastclosefromdrm_release+0x424/0x47c
drm_releasefrom__fput+0xf8/0x1d4
__fputfrom____fput+0x18/0x1c
____fputfromtask_work_run+0xa8/0xbc
task_work_runfromdo_exit+0x448/0x91c
do_exitfromdo_group_exit+0x5c/0xcc
do_group_exitfromget_signal+0x4dc/0x57c
get_signalfromdo_signal+0x9c/0x3b4
do_signalfromdo_work_pending+0x60/0xb8
do_work_pendingfromslow_work_pending+0xc/0x20I found that I could fix the crash by checking
connector->stateagainst NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in.
Quoted 5 lines
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>This is a driver bug - under atomic the assumption is that there is _always_ a current software state. Most driver set up the initial "everything off" state in the ->reset functions.
Ah, I see what the problem is. It looks like the main Rockchip subsystem moved to atomic but the patch to support that in dw_hdmi never landed. If I pick <https://patchwork.kernel.org/patch/7868951/>
then my crash goes away. :)
In case it's not obvious, please consider $SUBJECT patch abandoned. Thanks!
-Doug
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 37 lines · Doug Anderson
Daniel,
Quoted 28 lines · Daniel Vetter
Quoted 27 lines · Douglas Anderson
On a system I'm doing development on I found a crash. The crawl looked like:
PC is at
drm_atomic_add_affected_connectors+0x98/0xe8
...
drm_atomic_add_affected_connectorsfrom__drm_atomic_helper_set_config+0x218/0x344__drm_atomic_helper_set_configfromrestore_fbdev_mode+0x108/0x250restore_fbdev_modefromdrm_fb_helper_restore_fbdev_mode_unlocked+0x3c/0x80drm_fb_helper_restore_fbdev_mode_unlockedfromrockchip_drm_lastclose+0x1c/0x20rockchip_drm_lastclosefromdrm_lastclose+0x4c/0x104
drm_lastclosefromdrm_release+0x424/0x47c
drm_releasefrom__fput+0xf8/0x1d4
__fputfrom____fput+0x18/0x1c
____fputfromtask_work_run+0xa8/0xbc
task_work_runfromdo_exit+0x448/0x91c
do_exitfromdo_group_exit+0x5c/0xcc
do_group_exitfromget_signal+0x4dc/0x57c
get_signalfromdo_signal+0x9c/0x3b4
do_signalfromdo_work_pending+0x60/0xb8
do_work_pendingfromslow_work_pending+0xc/0x20I found that I could fix the crash by checking
connector->stateagainst NULL. This isn't code I'm familiar with and I didn't dig too deep, so I'd appreciate any opinions about whether this is a sane thing to do. Note that I don't actually have graphics up on my system at the moment, so perhaps this is all just a symptom of the strange state I'm in.Quoted 5 lines
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>This is a driver bug - under atomic the assumption is that there is _always_ a current software state. Most driver set up the initial "everything off" state in the ->reset functions.
Quoted 6 lines
Ah, I see what the problem is. It looks like the main Rockchip subsystem moved to atomic but the patch to support that in
dw_hdminever landed. If I pick <https://patchwork.kernel.org/patch/7868951/>
then my crash goes away. :)In case it's not obvious, please consider $SUBJECT patch abandoned. Thanks!
Argh. ...or the needed patch landed but I didn't pick it back in my backport. Even dumber. :(
-Doug
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel