dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/tilcdc: Check priv->crtc validity in cpufreq_transition()
@ 2019-08-02  8:39 Peter Ujfalusi
  2019-08-02  9:35 ` Jyri Sarha
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Ujfalusi @ 2019-08-02  8:39 UTC (permalink / raw)
  To: jsarha; +Cc: airlied, tomi.valkeinen, dri-devel

The notifier can be called before we have crtc. With the check we can avoid
NULL pointer dereference within tilcdc_crtc_update_clk().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 3046a4a4232d..85093123722d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -169,7 +169,7 @@ static int cpufreq_transition(struct notifier_block *nb,
 	struct tilcdc_drm_private *priv = container_of(nb,
 			struct tilcdc_drm_private, freq_transition);
 
-	if (val == CPUFREQ_POSTCHANGE)
+	if (val == CPUFREQ_POSTCHANGE && priv->crtc)
 		tilcdc_crtc_update_clk(priv->crtc);
 
 	return 0;
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tilcdc: Check priv->crtc validity in cpufreq_transition()
  2019-08-02  8:39 [PATCH] drm/tilcdc: Check priv->crtc validity in cpufreq_transition() Peter Ujfalusi
@ 2019-08-02  9:35 ` Jyri Sarha
  2019-08-02  9:55   ` Peter Ujfalusi
  0 siblings, 1 reply; 3+ messages in thread
From: Jyri Sarha @ 2019-08-02  9:35 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, tomi.valkeinen, dri-devel

On 02/08/2019 11:39, Peter Ujfalusi wrote:
> The notifier can be called before we have crtc. With the check we can avoid
> NULL pointer dereference within tilcdc_crtc_update_clk().
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Peter, do you have "drm/tilcdc: Register cpufreq notifier after we have
initialized crtc" [1] in your branch? It was merged in v5.0. If you do
and still see the crash, then I need to study this more.

Best regards,
Jyri

[1] https://patchwork.freedesktop.org/patch/292412/
    commit 432973fd3a20102840d5f7e61af9f1a03c217a4c

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 3046a4a4232d..85093123722d 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -169,7 +169,7 @@ static int cpufreq_transition(struct notifier_block *nb,
>  	struct tilcdc_drm_private *priv = container_of(nb,
>  			struct tilcdc_drm_private, freq_transition);
>  
> -	if (val == CPUFREQ_POSTCHANGE)
> +	if (val == CPUFREQ_POSTCHANGE && priv->crtc)
>  		tilcdc_crtc_update_clk(priv->crtc);
>  
>  	return 0;
> 


-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tilcdc: Check priv->crtc validity in cpufreq_transition()
  2019-08-02  9:35 ` Jyri Sarha
@ 2019-08-02  9:55   ` Peter Ujfalusi
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2019-08-02  9:55 UTC (permalink / raw)
  To: Jyri Sarha; +Cc: airlied, tomi.valkeinen, dri-devel



On 02/08/2019 12.35, Jyri Sarha wrote:
> On 02/08/2019 11:39, Peter Ujfalusi wrote:
>> The notifier can be called before we have crtc. With the check we can avoid
>> NULL pointer dereference within tilcdc_crtc_update_clk().
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> Peter, do you have "drm/tilcdc: Register cpufreq notifier after we have
> initialized crtc" [1] in your branch? It was merged in v5.0. If you do
> and still see the crash, then I need to study this more.
> 
> Best regards,
> Jyri
> 
> [1] https://patchwork.freedesktop.org/patch/292412/
>     commit 432973fd3a20102840d5f7e61af9f1a03c217a4c

Your patch fixed the issue in a better way. I was just carrying this
since December 2018 and since it still applies I thought that I will
send it...

Just ignore this patch and thanks for the proper fix.

> 
>> ---
>>  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
>> index 3046a4a4232d..85093123722d 100644
>> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
>> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
>> @@ -169,7 +169,7 @@ static int cpufreq_transition(struct notifier_block *nb,
>>  	struct tilcdc_drm_private *priv = container_of(nb,
>>  			struct tilcdc_drm_private, freq_transition);
>>  
>> -	if (val == CPUFREQ_POSTCHANGE)
>> +	if (val == CPUFREQ_POSTCHANGE && priv->crtc)
>>  		tilcdc_crtc_update_clk(priv->crtc);
>>  
>>  	return 0;
>>
> 
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-02  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  8:39 [PATCH] drm/tilcdc: Check priv->crtc validity in cpufreq_transition() Peter Ujfalusi
2019-08-02  9:35 ` Jyri Sarha
2019-08-02  9:55   ` Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).