From: Cho KyongHo Date: Thu, 5 Jan 2017 13:59:33 +0000 (+0900) Subject: [COMMON] iommu/exynos: fix possible NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5ea147f9719ed80234ff3dcf8b204319e1bc045e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 --- 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; }