Commit 36f27350 authored by Harshit Mogalapalli's avatar Harshit Mogalapalli Committed by Tvrtko Ursulin

i915/perf: Fix NULL deref bugs with drm_dbg() calls

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: 2fec5391 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call")
Suggested-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org> # v6.0+
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231027172822.2753059-1-harshit.m.mogalapalli@oracle.com
[tursulin: added stable tag]
parent 33f2af42
...@@ -4227,11 +4227,8 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data, ...@@ -4227,11 +4227,8 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,
u32 known_open_flags; u32 known_open_flags;
int ret; int ret;
if (!perf->i915) { if (!perf->i915)
drm_dbg(&perf->i915->drm,
"i915 perf interface not available for this system\n");
return -ENOTSUPP; return -ENOTSUPP;
}
known_open_flags = I915_PERF_FLAG_FD_CLOEXEC | known_open_flags = I915_PERF_FLAG_FD_CLOEXEC |
I915_PERF_FLAG_FD_NONBLOCK | I915_PERF_FLAG_FD_NONBLOCK |
...@@ -4607,11 +4604,8 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data, ...@@ -4607,11 +4604,8 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
struct i915_oa_reg *regs; struct i915_oa_reg *regs;
int err, id; int err, id;
if (!perf->i915) { if (!perf->i915)
drm_dbg(&perf->i915->drm,
"i915 perf interface not available for this system\n");
return -ENOTSUPP; return -ENOTSUPP;
}
if (!perf->metrics_kobj) { if (!perf->metrics_kobj) {
drm_dbg(&perf->i915->drm, drm_dbg(&perf->i915->drm,
...@@ -4773,11 +4767,8 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data, ...@@ -4773,11 +4767,8 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
struct i915_oa_config *oa_config; struct i915_oa_config *oa_config;
int ret; int ret;
if (!perf->i915) { if (!perf->i915)
drm_dbg(&perf->i915->drm,
"i915 perf interface not available for this system\n");
return -ENOTSUPP; return -ENOTSUPP;
}
if (i915_perf_stream_paranoid && !perfmon_capable()) { if (i915_perf_stream_paranoid && !perfmon_capable()) {
drm_dbg(&perf->i915->drm, drm_dbg(&perf->i915->drm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment