From 9bc9fdc7a378ef3bd3ec5ee11fd12d8926546a6d Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 30 Nov 2023 02:41:35 +0000 Subject: [PATCH] i915/perf: Fix NULL deref bugs with drm_dbg() calls From Harshit Mogalapalli 55db76caa782baa4a1bf02296e2773c38a524a3e in linux-6.1.y/6.1.64 471aa951bf1206d3c10d0daa67005b8e4db4ff83 in mainline linux --- sys/dev/pci/drm/i915/i915_perf.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sys/dev/pci/drm/i915/i915_perf.c b/sys/dev/pci/drm/i915/i915_perf.c index 015d953c266..892a3a1fa5f 100644 --- a/sys/dev/pci/drm/i915/i915_perf.c +++ b/sys/dev/pci/drm/i915/i915_perf.c @@ -3846,11 +3846,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 | @@ -4186,11 +4183,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, @@ -4353,11 +4347,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, -- 2.20.1