summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-06-05 10:30:55 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-06-05 12:23:52 +0300
commit9c2ca46391ea2ba089d5d082a0dbdd3b15b28498 (patch)
tree19b4ceef6c687d85ff9816644b31929b347b9ada
parent98071d3109c131820439f61d9380c0bd4cd2119a (diff)
libcamera: dma_buf_allocator: Create memfd with CLOEXEC
Ensure that the memfd file descriptor won't be leaked to child processes by creating it with MFD_CLOEXEC. Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/dma_buf_allocator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp
index 5ae51721..5ec29949 100644
--- a/src/libcamera/dma_buf_allocator.cpp
+++ b/src/libcamera/dma_buf_allocator.cpp
@@ -132,7 +132,7 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)
std::size_t pageMask = sysconf(_SC_PAGESIZE) - 1;
size = (size + pageMask) & ~pageMask;
- int ret = memfd_create(name, MFD_ALLOW_SEALING);
+ int ret = memfd_create(name, MFD_ALLOW_SEALING | MFD_CLOEXEC);
if (ret < 0) {
ret = errno;
LOG(DmaBufAllocator, Error)