mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	error27@gmail.com
Subject: Re: [PATCH] i915/perf: Fix NULL deref bugs with drm_dbg() calls
Date: Fri, 27 Oct 2023 22:48:45 +0530	[thread overview]
Message-ID: <f7562b7e-0a1c-46ea-aa72-236ada533558@oracle.com> (raw)
In-Reply-To: <4d850f3c-c199-470f-b83e-00bd9fddbd7a@linux.intel.com>

Hi Tvrtko,

On 27/10/23 8:17 pm, Tvrtko Ursulin wrote:
> 
> On 27/10/2023 15:11, Andrzej Hajda wrote:
>> On 27.10.2023 16:07, Harshit Mogalapalli wrote:
>>> When i915 perf interface is not available dereferencing it will lead to
>>> NULL dereferences.
>>>
>>> Fix this by using DRM_DEBUG() which the scenario before the commit in
>>> the Fixes tag.
>>>
>>> Fixes: 2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver 
>>> specific drm_dbg call")
>>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>>
>>
>> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
> 
> Please hold off merging.
> 
>>> ---
>>> This is found using smatch(static analysis tool), only compile tested.
>>> ---
>>>   drivers/gpu/drm/i915/i915_perf.c | 9 +++------
>>>   1 file changed, 3 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
>>> b/drivers/gpu/drm/i915/i915_perf.c
>>> index 2f3ecd7d4804..bb48c96b7950 100644
>>> --- a/drivers/gpu/drm/i915/i915_perf.c
>>> +++ b/drivers/gpu/drm/i915/i915_perf.c
>>> @@ -4228,8 +4228,7 @@ int i915_perf_open_ioctl(struct drm_device 
>>> *dev, void *data,
>>>       int ret;
>>>       if (!perf->i915) {
>>> -        drm_dbg(&perf->i915->drm,
>>> -            "i915 perf interface not available for this system\n");
>>> +        DRM_DEBUG("i915 perf interface not available for this 
>>> system\n");
> 
> What's that struct drm_device *dev function argument a few lines up? :)
> 
> Although TBH all these these could just be removed since I doubt they 
> are adding any value and ENOTSUPP is pretty clear.
> 

Thanks for checking. I will remove the dbg() calls and send a V2.

Regards,
Harshit

> Regards,
> 
> Tvrtko
> 
>>>           return -ENOTSUPP;
>>>       }
>>> @@ -4608,8 +4607,7 @@ int i915_perf_add_config_ioctl(struct 
>>> drm_device *dev, void *data,
>>>       int err, id;
>>>       if (!perf->i915) {
>>> -        drm_dbg(&perf->i915->drm,
>>> -            "i915 perf interface not available for this system\n");
>>> +        DRM_DEBUG("i915 perf interface not available for this 
>>> system\n");
>>>           return -ENOTSUPP;
>>>       }
>>> @@ -4774,8 +4772,7 @@ int i915_perf_remove_config_ioctl(struct 
>>> drm_device *dev, void *data,
>>>       int ret;
>>>       if (!perf->i915) {
>>> -        drm_dbg(&perf->i915->drm,
>>> -            "i915 perf interface not available for this system\n");
>>> +        DRM_DEBUG("i915 perf interface not available for this 
>>> system\n");
>>>           return -ENOTSUPP;
>>>       }
>>


           reply	other threads:[~2023-10-27 17:19 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4d850f3c-c199-470f-b83e-00bd9fddbd7a@linux.intel.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7562b7e-0a1c-46ea-aa72-236ada533558@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lionel.g.landwerlin@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®