Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: Check for an LPSP encoder before dereferencing
Date: Thu, 30 Jul 2020 12:21:25 +0530	[thread overview]
Message-ID: <20200730065124.GA30770@intel.com> (raw)
In-Reply-To: <20200729130912.30093-1-chris@chris-wilson.co.uk>

On 2020-07-29 at 14:09:12 +0100, Chris Wilson wrote:
> Avoid a GPF at
> 
> <1>[   20.177320] BUG: kernel NULL pointer dereference, address: 000000000000007c
> <1>[   20.177322] #PF: supervisor read access in kernel mode
> <1>[   20.177323] #PF: error_code(0x0000) - not-present page
> <6>[   20.177324] PGD 0 P4D 0
> <4>[   20.177327] Oops: 0000 [#1] PREEMPT SMP PTI
> <4>[   20.177328] CPU: 1 PID: 944 Comm: debugfs_test Not tainted 5.8.0-rc7-CI-CI_DRM_8814+ #1
> <4>[   20.177330] Hardware name: Dell Inc. XPS 13 9360/0823VW, BIOS 2.9.0 07/09/2018
> <4>[   20.177372] RIP: 0010:i915_lpsp_capability_show+0x44/0xc0 [i915]
> <4>[   20.177374] Code: 0f b6 81 ca 0d 00 00 3c 0b 74 77 76 19 3c 0c 75 44 83 7e 7c 01 7e 2f 48 c7 c6 d7 b9 47 a0 e8 43 df 06 e1 31 c0 c3 3c 09 72 2b <8b> 46 7c 85 c0 75 e6 8b 82 e4 00 00 00 89 c2 83 e2 fb 83 fa 0a 74
> <4>[   20.177376] RSP: 0018:ffffc90000cebe38 EFLAGS: 00010246
> <4>[   20.177377] RAX: 0000000000000009 RBX: ffff888267fe6a58 RCX: ffff888252d10000
> <4>[   20.177378] RDX: ffff88824a9a4000 RSI: 0000000000000000 RDI: ffff888267fe6a30
> <4>[   20.177379] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
> <4>[   20.177380] R10: 0000000000000001 R11: 0000000000000000 R12: ffffc90000cebf08
> <4>[   20.177381] R13: 00000000ffffffff R14: 0000000000000001 R15: ffff888267fe6a30
> <4>[   20.177383] FS:  00007f6f9c6b5e40(0000) GS:ffff888276480000(0000) knlGS:0000000000000000
> <4>[   20.177384] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> <4>[   20.177385] CR2: 000000000000007c CR3: 0000000255f04006 CR4: 00000000003606e0
> <4>[   20.177386] Call Trace:
> <4>[   20.177390]  seq_read+0xcb/0x420
> 
> which is presumably from having no encoder attached at that time.
> 
> Fixes: 8806211fe7b3 ("drm/i915: Add i915_lpsp_capability debugfs")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Animesh Manna <animesh.manna@intel.com>
> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_debugfs.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index 3644752cc5ec..5a5cfe25085b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -2044,9 +2044,12 @@ DEFINE_SHOW_ATTRIBUTE(i915_hdcp_sink_capability);
>  static int i915_lpsp_capability_show(struct seq_file *m, void *data)
>  {
>  	struct drm_connector *connector = m->private;
> -	struct intel_encoder *encoder =
> -			intel_attached_encoder(to_intel_connector(connector));
>  	struct drm_i915_private *i915 = to_i915(connector->dev);
> +	struct intel_encoder *encoder;
> +
> +	encoder = intel_attached_encoder(to_intel_connector(connector));
> +	if (!encoder)
> +		return -ENODEV;
>  
>  	if (connector->status != connector_status_connected)
>  		return -ENODEV;
> -- 
> 2.20.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2020-07-30  7:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 13:09 [Intel-gfx] [PATCH] drm/i915/display: Check for an LPSP encoder before dereferencing Chris Wilson
2020-07-29 13:32 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-07-29 13:32 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-07-29 13:51 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-07-29 15:11 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-07-30  6:51 ` Anshuman Gupta [this message]

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=20200730065124.GA30770@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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