* [PATCH] media: exynos4-is: fix DMA memory double free @ 2026-10-27 14:53 ` Guangshuo Li 2026-10-27 15:32 ` Krzysztof Kozlowski 2026-10-28 9:43 ` Marek Szyprowski 0 siblings, 2 replies; 4+ messages in thread From: Guangshuo Li @ 2026-10-27 14:53 UTC (permalink / raw) To: Sylwester Nawrocki, Mauro Carvalho Chehab, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar, Marek Szyprowski, Hans Verkuil, linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel Cc: Guangshuo Li, stable fimc_is_alloc_cpu_memory() frees the coherent DMA buffer when its DMA address does not satisfy the firmware alignment requirement, but leaves is->memory.vaddr non-NULL. Because firmware loading is asynchronous, this error path may run after probe has returned successfully. A later remove can then attempt to free the same DMA allocation again. Set is->memory.vaddr to NULL after freeing the buffer so the existing NULL check in fimc_is_free_cpu_memory() skips the already-freed allocation. This issue was found by our static analysis tool under development. Fixes: db47622c13ae ("media: platform: exynos4-is: remove all references to physical addresses") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> --- drivers/media/platform/samsung/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c index b7d9bfedd590..9fdc352abfe4 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c @@ -346,6 +346,7 @@ static int fimc_is_alloc_cpu_memory(struct fimc_is *is) (u32)is->memory.addr); dma_free_coherent(dev, is->memory.size, is->memory.vaddr, is->memory.addr); + is->memory.vaddr = NULL; return -EIO; } -- 2.43.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos4-is: fix DMA memory double free 2026-10-27 14:53 ` [PATCH] media: exynos4-is: fix DMA memory double free Guangshuo Li @ 2026-10-27 15:32 ` Krzysztof Kozlowski 2026-10-27 16:22 ` Guangshuo Li 2026-10-28 9:43 ` Marek Szyprowski 1 sibling, 1 reply; 4+ messages in thread From: Krzysztof Kozlowski @ 2026-10-27 15:32 UTC (permalink / raw) To: Guangshuo Li, Sylwester Nawrocki, Mauro Carvalho Chehab, Peter Griffin, Alim Akhtar, Marek Szyprowski, Hans Verkuil, linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel Cc: stable On 27/10/2026 15:53, Guangshuo Li wrote: > fimc_is_alloc_cpu_memory() frees the coherent DMA buffer when its > DMA address does not satisfy the firmware alignment requirement, > but leaves is->memory.vaddr non-NULL. > > Because firmware loading is asynchronous, this error path may run > after probe has returned successfully. A later remove can then > attempt to free the same DMA allocation again. > > Set is->memory.vaddr to NULL after freeing the buffer so the > existing NULL check in fimc_is_free_cpu_memory() skips the > already-freed allocation. > > This issue was found by our static analysis tool under development. > > Fixes: db47622c13ae ("media: platform: exynos4-is: remove all references to physical addresses") > Cc: stable@vger.kernel.org > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> > --- More of postings by bot ignoring any feedback. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos4-is: fix DMA memory double free 2026-10-27 15:32 ` Krzysztof Kozlowski @ 2026-10-27 16:22 ` Guangshuo Li 0 siblings, 0 replies; 4+ messages in thread From: Guangshuo Li @ 2026-10-27 16:22 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, Peter Griffin, Alim Akhtar, Marek Szyprowski, Hans Verkuil, linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel, stable Hi Krzysztof, On Tue, 27 Oct 2026 at 23:32, Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 27/10/2026 15:53, Guangshuo Li wrote: > > fimc_is_alloc_cpu_memory() frees the coherent DMA buffer when its > > DMA address does not satisfy the firmware alignment requirement, > > but leaves is->memory.vaddr non-NULL. > > > > Because firmware loading is asynchronous, this error path may run > > after probe has returned successfully. A later remove can then > > attempt to free the same DMA allocation again. > > > > Set is->memory.vaddr to NULL after freeing the buffer so the > > existing NULL check in fimc_is_free_cpu_memory() skips the > > already-freed allocation. > > > > This issue was found by our static analysis tool under development. > > > > Fixes: db47622c13ae ("media: platform: exynos4-is: remove all references to physical addresses") > > Cc: stable@vger.kernel.org > > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> > > --- > > More of postings by bot ignoring any feedback. > > Best regards, > Krzysztof Thank you for your feedback, and I apologize if our recent submissions gave the impression that we were ignoring your previous comments. We did take your earlier suggestions into account and subsequently submitted a patch series accordingly. For the more recent patches, however, since they address issues in different drivers, we thought it would be more appropriate to submit them separately rather than group them into a single series. We certainly did not intend to disregard your feedback. We appreciate your time and guidance, and we will be more careful with our future submissions. Thank you for your understanding. Best regards, Guangshuo Li ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos4-is: fix DMA memory double free 2026-10-27 14:53 ` [PATCH] media: exynos4-is: fix DMA memory double free Guangshuo Li 2026-10-27 15:32 ` Krzysztof Kozlowski @ 2026-10-28 9:43 ` Marek Szyprowski 1 sibling, 0 replies; 4+ messages in thread From: Marek Szyprowski @ 2026-10-28 9:43 UTC (permalink / raw) To: Guangshuo Li, Sylwester Nawrocki, Mauro Carvalho Chehab, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar, Hans Verkuil, linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel Cc: stable On 27.10.2026 15:53, Guangshuo Li wrote: > fimc_is_alloc_cpu_memory() frees the coherent DMA buffer when its > DMA address does not satisfy the firmware alignment requirement, > but leaves is->memory.vaddr non-NULL. > > Because firmware loading is asynchronous, this error path may run > after probe has returned successfully. A later remove can then > attempt to free the same DMA allocation again. > > Set is->memory.vaddr to NULL after freeing the buffer so the > existing NULL check in fimc_is_free_cpu_memory() skips the > already-freed allocation. > > This issue was found by our static analysis tool under development. > > Fixes: db47622c13ae ("media: platform: exynos4-is: remove all references to physical addresses") > Cc: stable@vger.kernel.org > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> but I would relax a bit the severity of this issue. I'm not sure if it makes sense to bother stable team with it and I would add 'potential' word to the subject. In practice this case would not happen. > --- > drivers/media/platform/samsung/exynos4-is/fimc-is.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c > index b7d9bfedd590..9fdc352abfe4 100644 > --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c > +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c > @@ -346,6 +346,7 @@ static int fimc_is_alloc_cpu_memory(struct fimc_is *is) > (u32)is->memory.addr); > dma_free_coherent(dev, is->memory.size, is->memory.vaddr, > is->memory.addr); > + is->memory.vaddr = NULL; > return -EIO; > } > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-28 9:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20261027145330eucas1p1b07eaac7858482b12d90a342fae36f2f@eucas1p1.samsung.com>
2026-10-27 14:53 ` [PATCH] media: exynos4-is: fix DMA memory double free Guangshuo Li
2026-10-27 15:32 ` Krzysztof Kozlowski
2026-10-27 16:22 ` Guangshuo Li
2026-10-28 9:43 ` Marek Szyprowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®