summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2017-08-14 23:53:45 +0200
committerThierry Reding <treding@nvidia.com>2017-08-17 17:57:10 +0200
commit68d890a3cca5a96a5443972922c84df89f6301e6 (patch)
tree7ce0be4cd2aa28f31439234f164a4141bedc431b /drivers/gpu/drm/tegra
parent7664b2fa42b5e962dd9ffd9e386dc20cbc966176 (diff)
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 <mirq-linux@rere.qmqm.pl> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/drm.c8
1 files changed, 5 insertions, 3 deletions
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;
}