From 3e8b3fb984a3eb11b83eb784ff879a785a55ba33 Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Wed, 26 Jul 2017 15:34:09 +0800 Subject: [PATCH] drm/rockchip: fix mm_dump NULL pointer crash drm mm is not initial on non-iommu context. Fix crash: [ 11.635376] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 11.636148] pgd = ffffffc0de19d000 [ 11.636474] [00000000] *pgd=0000000000000000, *pud=0000000000000000 [ 11.637088] Internal error: Oops: 96000045 [#1] PREEMPT SMP [ 11.637594] Modules linked in: [ 11.637902] CPU: 4 PID: 424 Comm: sh Not tainted 4.4.71 #146 [ 11.638406] Hardware name: Rockchip RK3399 Evaluation Board v3 (Android) (DT) [ 11.639050] task: ffffffc0de796800 ti: ffffffc0de260000 task.ti: ffffffc0de260000 [ 11.639736] PC is at __mutex_lock_slowpath+0xa8/0x178 [ 11.640198] LR is at __mutex_lock_slowpath+0x7c/0x178 [ 11.788003] [] __mutex_lock_slowpath+0xa8/0x178 [ 11.788560] [] mutex_lock+0x2c/0x44 [ 11.789024] [] rockchip_drm_mm_dump+0x30/0x5c [ 11.789560] [] seq_read+0x1a8/0x3f8 [ 11.790017] [] __vfs_read+0x38/0xf4 [ 11.790472] [] vfs_read+0x84/0x128 [ 11.790927] [] SyS_read+0x54/0xa4 [ 11.791372] [] el0_svc_naked+0x24/0x28 Change-Id: I342311da43d50b743257b81425dfc6a327306803 Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index a38275f2c511..3699a94a7897 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -896,6 +896,9 @@ static int rockchip_drm_mm_dump(struct seq_file *s, void *data) struct rockchip_drm_private *priv = drm_dev->dev_private; int ret; + if (!priv->domain) + return 0; + mutex_lock(&priv->mm_lock); ret = drm_mm_dump_table(s, &priv->mm); -- 2.34.1