From 7b8e151b332abb33f1f447d4d2d50e0bcb34f372 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 2 Oct 2025 19:31:08 +0300 Subject: [PATCH] dma: add verify handling for all exported syscalls Multiple dma.h functions are marked to be supported as syscalls, but don't have a verify handler, so attempt to use from user-space will fail. Add the missing verify handlers for dma_request_channel(), dma_release_channel(), dma_suspend() and dma_resume(). Signed-off-by: Kai Vehmanen --- drivers/dma/dma_handlers.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_handlers.c b/drivers/dma/dma_handlers.c index 9ebce367482ea..703d5cca2ca93 100644 --- a/drivers/dma/dma_handlers.c +++ b/drivers/dma/dma_handlers.c @@ -7,7 +7,7 @@ #include #include -/* Both of these APIs are assuming that the drive implementations are checking +/* All of these APIs are assuming that the drive implementations are checking * the validity of the channel ID and returning -errno if it's bogus */ @@ -24,3 +24,39 @@ static inline int z_vrfy_dma_stop(const struct device *dev, uint32_t channel) return z_impl_dma_stop((const struct device *)dev, channel); } #include + +static int z_vrfy_dma_chan_filter(const struct device * dev, int channel, void * filter_param) +{ + K_OOPS(K_SYSCALL_DRIVER_DMA(dev, chan_filter)); + return z_impl_dma_chan_filter((const struct device *)dev, channel, filter_param); +} +#include + +static inline int z_vrfy_dma_request_channel(const struct device * dev, void * filter_param) +{ + /* uses 'chan_filter' op in the implementation */ + K_OOPS(K_SYSCALL_DRIVER_DMA(dev, chan_filter)); + return z_impl_dma_request_channel((const struct device *)dev, filter_param); +} +#include + +static inline void z_vrfy_dma_release_channel(const struct device * dev, uint32_t channel) +{ + K_OOPS(K_SYSCALL_DRIVER_DMA(dev, chan_release)); + z_impl_dma_release_channel((const struct device *)dev, channel); +} +#include + +static inline int z_vrfy_dma_suspend(const struct device * dev, uint32_t channel) +{ + K_OOPS(K_SYSCALL_DRIVER_DMA(dev, suspend)); + return z_impl_dma_suspend((const struct device *)dev, channel); +} +#include + +static inline int z_vrfy_dma_resume(const struct device * dev, uint32_t channel) +{ + K_OOPS(K_SYSCALL_DRIVER_DMA(dev, resume)); + return z_impl_dma_resume((const struct device *)dev, channel); +} +#include