Skip to content

Commit

Permalink
drm/i915/guc: Don't go bang in GuC log if no GuC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
John Harrison authored and John Harrison committed Dec 11, 2021
1 parent 3d832f3 commit 76aee86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int guc_log_level_get(void *data, u64 *val)
{
struct intel_guc_log *log = data;

if (!intel_guc_is_used(log_to_guc(log)))
if (!log->vma)
return -ENODEV;

*val = intel_guc_log_get_level(log);
Expand All @@ -43,7 +43,7 @@ static int guc_log_level_set(void *data, u64 val)
{
struct intel_guc_log *log = data;

if (!intel_guc_is_used(log_to_guc(log)))
if (!log->vma)
return -ENODEV;

return intel_guc_log_set_level(log, val);
Expand Down

0 comments on commit 76aee86

Please sign in to comment.