• Chris Wilson's avatar
    drm/i915/display: Check for an LPSP encoder before dereferencing · b7c66461
    Chris Wilson authored
    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.
    
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2175
    Fixes: 8806211f ("drm/i915: Add i915_lpsp_capability debugfs")
    Signed-off-by: default avatarChris 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: default avatarAnshuman Gupta <anshuman.gupta@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200729130912.30093-1-chris@chris-wilson.co.ukSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    (cherry picked from commit a22b1a9b)
    Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
    b7c66461
intel_display_debugfs.c 60.6 KB