]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: exynos4-is: Free FIMC-IS CPU memory only when allocated
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Thu, 8 May 2014 17:35:15 +0000 (14:35 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:13:58 +0000 (20:13 -0700)
commit 404a90abc60f60df2757cb272660e003d326881f upstream.

Ensure dma_free_coherent() is not called with incorrect arguments
and only when the memory was actually allocated. This will prevent
possible crashes on error paths of the top level media device driver,
when fimc-is device gets unregistered and its driver detached.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/exynos4-is/fimc-is.c

index 128b73b6cce26289702fdd47cad801d3164caf12..5476dce3ad293716fc940b130d1cf9f4aaa219c5 100644 (file)
@@ -367,6 +367,9 @@ static void fimc_is_free_cpu_memory(struct fimc_is *is)
 {
        struct device *dev = &is->pdev->dev;
 
+       if (is->memory.vaddr == NULL)
+               return;
+
        dma_free_coherent(dev, is->memory.size, is->memory.vaddr,
                          is->memory.paddr);
 }