mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.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>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	Lionel Landwerlin <lionel.g.landwerlin@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, Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [PATCH v2] i915/perf: Fix NULL deref bugs with drm_dbg() calls
Date: Fri, 27 Oct 2023 18:38:21 +0100	[thread overview]
Message-ID: <29c2bf2b-82b1-457d-ba42-29b0b30ecf32@linux.intel.com> (raw)
In-Reply-To: <20231027172822.2753059-1-harshit.m.mogalapalli@oracle.com>


On 27/10/2023 18:28, Harshit Mogalapalli wrote:
> When i915 perf interface is not available dereferencing it will lead to
> NULL dereferences.
> 
> As returning -ENOTSUPP is pretty clear return when perf interface is not
> available.
> 
> Fixes: 2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call")
> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> v1 --> v2: Remove the debug calls as they don't add much value and
> -ENOTSUPP is a good enough return value.
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 2f3ecd7d4804..7b1c8de2f9cb 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -4227,11 +4227,8 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,
>   	u32 known_open_flags;
>   	int ret;
>   
> -	if (!perf->i915) {
> -		drm_dbg(&perf->i915->drm,
> -			"i915 perf interface not available for this system\n");
> +	if (!perf->i915)
>   		return -ENOTSUPP;
> -	}
>   
>   	known_open_flags = I915_PERF_FLAG_FD_CLOEXEC |
>   			   I915_PERF_FLAG_FD_NONBLOCK |
> @@ -4607,11 +4604,8 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
>   	struct i915_oa_reg *regs;
>   	int err, id;
>   
> -	if (!perf->i915) {
> -		drm_dbg(&perf->i915->drm,
> -			"i915 perf interface not available for this system\n");
> +	if (!perf->i915)
>   		return -ENOTSUPP;
> -	}
>   
>   	if (!perf->metrics_kobj) {
>   		drm_dbg(&perf->i915->drm,
> @@ -4773,11 +4767,8 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
>   	struct i915_oa_config *oa_config;
>   	int ret;
>   
> -	if (!perf->i915) {
> -		drm_dbg(&perf->i915->drm,
> -			"i915 perf interface not available for this system\n");
> +	if (!perf->i915)
>   		return -ENOTSUPP;
> -	}
>   
>   	if (i915_perf_stream_paranoid && !perfmon_capable()) {
>   		drm_dbg(&perf->i915->drm,

Thanks for re-spinning it so quickly! LGTM.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 17:28 Harshit Mogalapalli
2023-10-27 17:38 ` Tvrtko Ursulin [this message]
2023-10-30 12:47   ` Tvrtko Ursulin

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=29c2bf2b-82b1-457d-ba42-29b0b30ecf32@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.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=harshit.m.mogalapalli@oracle.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@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®