diff mbox series

drm/i915: Fix possible null pointer dereference after drm_dbg_printer conversion

Message ID 20240219131423.1854991-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix possible null pointer dereference after drm_dbg_printer conversion | expand

Commit Message

Tvrtko Ursulin Feb. 19, 2024, 1:14 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Request can be NULL if no guilty request was identified so simply use
engine->i915 instead.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Rodrigo Vivi Feb. 19, 2024, 8:02 p.m. UTC | #1
On Mon, Feb 19, 2024 at 01:14:23PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Request can be NULL if no guilty request was identified so simply use
> engine->i915 instead.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Luca Coelho <luciano.coelho@intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> index 5f8d86e25993..8d4bb95f8424 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> @@ -96,8 +96,8 @@ static void heartbeat_commit(struct i915_request *rq,
>  static void show_heartbeat(const struct i915_request *rq,
>  			   struct intel_engine_cs *engine)
>  {
> -	struct drm_printer p = drm_dbg_printer(&rq->i915->drm, DRM_UT_DRIVER,
> -					       "heartbeat");
> +	struct drm_printer p =
> +		drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat");
>  
>  	if (!rq) {
>  		intel_engine_dump(engine, &p,
> -- 
> 2.40.1
>
Tvrtko Ursulin Feb. 20, 2024, 9:16 a.m. UTC | #2
On 19/02/2024 20:02, Rodrigo Vivi wrote:
> On Mon, Feb 19, 2024 at 01:14:23PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Request can be NULL if no guilty request was identified so simply use
>> engine->i915 instead.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Cc: Luca Coelho <luciano.coelho@intel.com>
>> Cc: Maxime Ripard <mripard@kernel.org>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Thanks Rodrigo!

Given how d50892a9554c landed via drm-misc-next, Maxime or Thomas - 
could you take this via drm-misc-next-fixes or if there will be another 
drm-misc-next pull request?

Regards,

Tvrtko

> 
>> ---
>>   drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
>> index 5f8d86e25993..8d4bb95f8424 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
>> @@ -96,8 +96,8 @@ static void heartbeat_commit(struct i915_request *rq,
>>   static void show_heartbeat(const struct i915_request *rq,
>>   			   struct intel_engine_cs *engine)
>>   {
>> -	struct drm_printer p = drm_dbg_printer(&rq->i915->drm, DRM_UT_DRIVER,
>> -					       "heartbeat");
>> +	struct drm_printer p =
>> +		drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat");
>>   
>>   	if (!rq) {
>>   		intel_engine_dump(engine, &p,
>> -- 
>> 2.40.1
>>
Maxime Ripard Feb. 20, 2024, 10:36 a.m. UTC | #3
On Tue, Feb 20, 2024 at 09:16:43AM +0000, Tvrtko Ursulin wrote:
> 
> On 19/02/2024 20:02, Rodrigo Vivi wrote:
> > On Mon, Feb 19, 2024 at 01:14:23PM +0000, Tvrtko Ursulin wrote:
> > > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > > 
> > > Request can be NULL if no guilty request was identified so simply use
> > > engine->i915 instead.
> > > 
> > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > > Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
> > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > > Cc: Jani Nikula <jani.nikula@intel.com>
> > > Cc: Luca Coelho <luciano.coelho@intel.com>
> > > Cc: Maxime Ripard <mripard@kernel.org>
> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > 
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> Thanks Rodrigo!
> 
> Given how d50892a9554c landed via drm-misc-next, Maxime or Thomas - could
> you take this via drm-misc-next-fixes or if there will be another
> drm-misc-next pull request?

There will be a drm-misc-next PR on thursday

Maxime
Tvrtko Ursulin Feb. 20, 2024, 1:45 p.m. UTC | #4
On 20/02/2024 10:36, Maxime Ripard wrote:
> On Tue, Feb 20, 2024 at 09:16:43AM +0000, Tvrtko Ursulin wrote:
>>
>> On 19/02/2024 20:02, Rodrigo Vivi wrote:
>>> On Mon, Feb 19, 2024 at 01:14:23PM +0000, Tvrtko Ursulin wrote:
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> Request can be NULL if no guilty request was identified so simply use
>>>> engine->i915 instead.
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
>>>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>>> Cc: Luca Coelho <luciano.coelho@intel.com>
>>>> Cc: Maxime Ripard <mripard@kernel.org>
>>>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>>>
>>> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>
>> Thanks Rodrigo!
>>
>> Given how d50892a9554c landed via drm-misc-next, Maxime or Thomas - could
>> you take this via drm-misc-next-fixes or if there will be another
>> drm-misc-next pull request?
> 
> There will be a drm-misc-next PR on thursday

Could you pull this one into which branch is needed so it appears in 
that pull request?

Regards,

Tvrtko
Maxime Ripard Feb. 22, 2024, 5:51 p.m. UTC | #5
On Mon, 19 Feb 2024 13:14:23 +0000, Tvrtko Ursulin wrote:
> Request can be NULL if no guilty request was identified so simply use
> engine->i915 instead.
> 
> 

Applied to drm/drm-misc (drm-misc-next-fixes).

Thanks!
Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
index 5f8d86e25993..8d4bb95f8424 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
@@ -96,8 +96,8 @@  static void heartbeat_commit(struct i915_request *rq,
 static void show_heartbeat(const struct i915_request *rq,
 			   struct intel_engine_cs *engine)
 {
-	struct drm_printer p = drm_dbg_printer(&rq->i915->drm, DRM_UT_DRIVER,
-					       "heartbeat");
+	struct drm_printer p =
+		drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat");
 
 	if (!rq) {
 		intel_engine_dump(engine, &p,