Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] exynos4-is: Free FIMC-IS CPU memory only when allocated

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>
Cc: stable@vger.kernel.org # for v3.15
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Sylwester Nawrocki and committed by
Mauro Carvalho Chehab
404a90ab f486e7c3

+3
+3
drivers/media/platform/exynos4-is/fimc-is.c
··· 367 367 { 368 368 struct device *dev = &is->pdev->dev; 369 369 370 + if (is->memory.vaddr == NULL) 371 + return; 372 + 370 373 dma_free_coherent(dev, is->memory.size, is->memory.vaddr, 371 374 is->memory.paddr); 372 375 }