Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/guc: Don't go bang in GuC log if no GuC

If the GuC has failed to load for any reason and then the user pokes
the debugfs GuC log interface, a BUG and/or null pointer deref can
occur. Don't let that happen.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211210044022.1842938-5-John.C.Harrison@Intel.com

+2 -2
+2 -2
drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
··· 31 31 { 32 32 struct intel_guc_log *log = data; 33 33 34 - if (!intel_guc_is_used(log_to_guc(log))) 34 + if (!log->vma) 35 35 return -ENODEV; 36 36 37 37 *val = intel_guc_log_get_level(log); ··· 43 43 { 44 44 struct intel_guc_log *log = data; 45 45 46 - if (!intel_guc_is_used(log_to_guc(log))) 46 + if (!log->vma) 47 47 return -ENODEV; 48 48 49 49 return intel_guc_log_set_level(log, val);