drm/amd/display: Check hpd_gpio for NULL before accessing it
Subsystems (3)
PATCH 1/1 drm/amd/display: Check hpd_gpio for NULL before accessing it
dal_gpio_open and dal_gpio_unlock_pin dereference hpd_gpio. Check for NULL before calling those functions.
---
I don't have a system to test this on. Can someone give it a spin?
Harry
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +4 -3
@@ -1127,10 +1127,11 @@ static bool construct( link->dc->res_pool->funcs->link_init (link); link->hpd_gpio =get_hpd_gpio (link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); -dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); -dal_gpio_unlock_pin (link->hpd_gpio); -if (link->hpd_gpio !=NULL ) +if (link->hpd_gpio !=NULL ) { +dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); +dal_gpio_unlock_pin (link->hpd_gpio); link->irq_source_hpd =dal_irq_get_source (link->hpd_gpio); + }switch (link->link_id.id) {case CONNECTOR_ID_HDMI_TYPE_A :
Signature · 6 lines
2.19.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190207201235.30106-1-harry.wentland-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Acked-byQuoted 9 lines · Harry Wentland
dal_gpio_openanddal_gpio_unlock_pindereferencehpd_gpio. Check for NULL before calling those functions.Fixes e261568f94d6 ("drm/amd/display: add gpio lock/unlock")Reported-by Przemek Socha <[email protected]>CC Chiawen Huang <[email protected]>CC Tony Cheng <[email protected]>Signed-off-by Harry Wentland <[email protected]>
Quoted 29 lines
---
I don't have a system to test this on. Can someone give it a spin?
Harry
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_link.c +4
-4@@ -1127,10 +1127,11 @@ static bool construct( link->dc->res_pool->funcs->link_init (link); link->hpd_gpio =get_hpd_gpio (link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); -dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); -dal_gpio_unlock_pin (link->hpd_gpio); -if (link->hpd_gpio !=NULL ) +if (link->hpd_gpio !=NULL ) { +dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); +dal_gpio_unlock_pin (link->hpd_gpio); link->irq_source_hpd =dal_irq_get_source (link->hpd_gpio); + }switch (link->link_id.id) {case CONNECTOR_ID_HDMI_TYPE_A : --
Quoted 2 lines
2.19.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CADnq5_OQQpvrrvrCYOGKgo_YtdT8gPwuMzLgWKAtwAoZmp-4Vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Alex Deucher
Tested-byQuoted 6 lines · Alex Deucher
Quoted 4 lines · Harry Wentland
dal_gpio_openanddal_gpio_unlock_pindereferencehpd_gpio. Check for NULL before calling those functions.
Quoted 8 lines
Quoted 5 lines
Fixes e261568f94d6 ("drm/amd/display: add gpio lock/unlock")Reported-by Przemek Socha <[email protected]>CC Chiawen Huang <[email protected]>CC Tony Cheng <[email protected]>Signed-off-by Harry Wentland <[email protected]>Acked-by Alex Deucher <[email protected]>
Just tried it on a bonaire.
Quoted 26 lines
Quoted 26 lines
---
I don't have a system to test this on. Can someone give it a spin?
Harry
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_link.c +4
-3@@ -1127,10 +1127,11 @@ static bool construct( link->dc->res_pool->funcs->link_init (link); link->hpd_gpio =get_hpd_gpio (link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); -dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); -dal_gpio_unlock_pin (link->hpd_gpio); -if (link->hpd_gpio !=NULL ) +if (link->hpd_gpio !=NULL ) { +dal_gpio_open (link->hpd_gpio,GPIO_MODE_INTERRUPT ); +dal_gpio_unlock_pin (link->hpd_gpio); link->irq_source_hpd =dal_irq_get_source (link->hpd_gpio); + }
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +0
-1switch (link->link_id.id) {case CONNECTOR_ID_HDMI_TYPE_A : --2.19.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx