i915/perf: Fix NULL deref bugs with drm_dbg() calls
authorjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:41:35 +0000 (02:41 +0000)
committerjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:41:35 +0000 (02:41 +0000)
From Harshit Mogalapalli
55db76caa782baa4a1bf02296e2773c38a524a3e in linux-6.1.y/6.1.64
471aa951bf1206d3c10d0daa67005b8e4db4ff83 in mainline linux

sys/dev/pci/drm/i915/i915_perf.c

index 015d953..892a3a1 100644 (file)
@@ -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,