public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Cc: DRI-Devel@Lists.FreeDesktop.Org
Subject: [Intel-gfx] [PATCH 4/4] drm/i915/guc: Don't go bang in GuC log if no GuC
Date: Thu,  2 Dec 2021 16:06:23 -0800	[thread overview]
Message-ID: <20211203000623.3086309-5-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <20211203000623.3086309-1-John.C.Harrison@Intel.com>

From: John Harrison <John.C.Harrison@Intel.com>

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>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
index 46026c2c1722..8fd068049376 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c
@@ -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);
@@ -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);
-- 
2.25.1


  parent reply	other threads:[~2021-12-03  0:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  0:06 [Intel-gfx] [PATCH 0/4] Assorted fixes/tweaks to GuC support John.C.Harrison
2021-12-03  0:06 ` [Intel-gfx] [PATCH 1/4] drm/i915/uc: Allow platforms to have GuC but not HuC John.C.Harrison
2021-12-03  0:06 ` [Intel-gfx] [PATCH 2/4] drm/i915/guc: Request RP0 before loading firmware John.C.Harrison
2021-12-03  0:06 ` [Intel-gfx] [PATCH 3/4] drm/i915/guc: Increase GuC log size for CONFIG_DEBUG_GEM John.C.Harrison
2021-12-03  0:06 ` John.C.Harrison [this message]
2021-12-03  0:33   ` [Intel-gfx] [PATCH 4/4] drm/i915/guc: Don't go bang in GuC log if no GuC Lucas De Marchi
2021-12-03 20:00     ` Daniele Ceraolo Spurio
2021-12-07  7:01       ` Lucas De Marchi
2021-12-03  0:20 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Assorted fixes/tweaks to GuC support Patchwork
2021-12-03  0:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-12-03  0:44 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-12-03  1:55 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-12-04  1:23 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Assorted fixes/tweaks to GuC support (rev3) Patchwork
2021-12-04  1:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-12-04  2:03 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2021-12-10  4:40 [Intel-gfx] [PATCH 0/4] Assorted fixes/tweaks to GuC support John.C.Harrison
2021-12-10  4:40 ` [Intel-gfx] [PATCH 4/4] drm/i915/guc: Don't go bang in GuC log if no GuC John.C.Harrison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211203000623.3086309-5-John.C.Harrison@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=DRI-Devel@Lists.FreeDesktop.Org \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox