From: Michał Mirosław Date: Mon, 14 Aug 2017 21:53:45 +0000 (+0200) Subject: drm/tegra: Fix NULL deref in debugfs/iova X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=68d890a3cca5a96a5443972922c84df89f6301e6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/tegra: Fix NULL deref in debugfs/iova When IOMMU is off, ->mm_lock is not initialized and ->mm is NULL. Signed-off-by: Michał Mirosław Signed-off-by: Thierry Reding --- diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index eddea778290f..86b3e1ce0b65 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1033,9 +1033,11 @@ static int tegra_debugfs_iova(struct seq_file *s, void *data) struct tegra_drm *tegra = drm->dev_private; struct drm_printer p = drm_seq_file_printer(s); - mutex_lock(&tegra->mm_lock); - drm_mm_print(&tegra->mm, &p); - mutex_unlock(&tegra->mm_lock); + if (tegra->domain) { + mutex_lock(&tegra->mm_lock); + drm_mm_print(&tegra->mm, &p); + mutex_unlock(&tegra->mm_lock); + } return 0; }