public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: tegra: fix NULL deref in debugfs/iova
@ 2017-08-14 21:53 Michał Mirosław
       [not found] ` <7ca7b47df4aa1c164b7313172564923a2639dcc1.1502747460.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Mirosław @ 2017-08-14 21:53 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Jonathan Hunter
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

When IOMMU is off, ->mm_lock is not initialized and ->mm is NULL.

Signed-off-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org>
---
 drivers/gpu/drm/tegra/drm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 8b7842548b9f..f859c06b8ab0 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;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-17 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-14 21:53 [PATCH] drm: tegra: fix NULL deref in debugfs/iova Michał Mirosław
     [not found] ` <7ca7b47df4aa1c164b7313172564923a2639dcc1.1502747460.git.mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org>
2017-08-17 15:34   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox