[COMMON] iommu/exynos: fix possible NULL pointer dereference
authorCho KyongHo <pullip.cho@samsung.com>
Thu, 5 Jan 2017 13:59:33 +0000 (22:59 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:20 +0000 (19:45 +0900)
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 <pullip.cho@samsung.com>
drivers/iommu/exynos-iovmm.c

index b61ad53f9a6b089fd16c4917b4b2fed0330a0ab4..178d942d8b3426b251bf1a301b4b8e4a68e5693c 100644 (file)
@@ -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;
        }