From 5ea147f9719ed80234ff3dcf8b204319e1bc045e Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Thu, 5 Jan 2017 22:59:33 +0900 Subject: [PATCH] [COMMON] iommu/exynos: fix possible NULL pointer dereference find_vma() may return NULL. It should be checked even though exynos_iovmm_map_userptr() requires the callers to acquire mmap_sem. SVACE WGID 87553 Change-Id: Ice3239234dc46177bce5963444f0c4cbc094fe40 Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iovmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iovmm.c b/drivers/iommu/exynos-iovmm.c index b61ad53f9a6b..178d942d8b34 100644 --- a/drivers/iommu/exynos-iovmm.c +++ b/drivers/iommu/exynos-iovmm.c @@ -513,7 +513,7 @@ dma_addr_t exynos_iovmm_map_userptr(struct device *dev, unsigned long vaddr, struct exynos_vm_region *region; vma = find_vma(current->mm, vaddr); - if (vaddr < vma->vm_start) { + if (!vma || (vaddr < vma->vm_start)) { dev_err(dev, "%s: invalid address %#lx\n", __func__, vaddr); goto err; } -- 2.20.1