From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
DRI-Devel@Lists.FreeDesktop.Org
Subject: [Intel-gfx] [PATCH v2 3/3] drm/i915/guc: Don't go bang in GuC log if no GuC
Date: Tue, 7 Dec 2021 12:19:32 -0800 [thread overview]
Message-ID: <20211207201932.240050-4-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <20211207201932.240050-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>
Reviewed-by: Lucas De Marchi <lucas.demarchi@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
next prev parent reply other threads:[~2021-12-07 20:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 20:19 [Intel-gfx] [PATCH v2 0/3] Assorted fixes/tweaks to GuC support John.C.Harrison
2021-12-07 20:19 ` [Intel-gfx] [PATCH v2 1/3] drm/i915/uc: Allow platforms to have GuC but not HuC John.C.Harrison
2021-12-07 20:19 ` [Intel-gfx] [PATCH v2 2/3] drm/i915/guc: Increase GuC log size for CONFIG_DEBUG_GEM John.C.Harrison
2021-12-07 20:19 ` John.C.Harrison [this message]
2021-12-07 23:20 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Assorted fixes/tweaks to GuC support (rev4) Patchwork
2021-12-07 23:22 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-12-08 0:01 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-12-08 21:09 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Assorted fixes/tweaks to GuC support (rev5) Patchwork
2021-12-08 21:10 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-12-08 21:40 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-12-09 4:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-12-09 23:56 ` John 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=20211207201932.240050-4-John.C.Harrison@Intel.com \
--to=john.c.harrison@intel.com \
--cc=DRI-Devel@Lists.FreeDesktop.Org \
--cc=Intel-GFX@Lists.FreeDesktop.Org \
--cc=lucas.demarchi@intel.com \
/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