summaryrefslogtreecommitdiff
path: root/drivers/dma-buf/dma-buf.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-08-28 13:34:53 +0100
committerMark Brown <broonie@kernel.org>2026-08-28 13:34:53 +0100
commit3ab5a84fe12f0df60b983ace94124cd89c0914dd (patch)
tree5f3f6ac46ee799da19217c89b20cb2958b9a5dcb /drivers/dma-buf/dma-buf.c
parentc7398d8634178c26a5139226444b44d4cd7407dc (diff)
parent20839d02c0cf7437bc508d4c5430538d9dc4f428 (diff)
downloadlinux-next-pending-fixes.tar.gz
linux-next-pending-fixes.zip
Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.gitpending-fixes
# Conflicts: # drivers/accel/ethosu/ethosu_drv.c # drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h # drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c
Diffstat (limited to 'drivers/dma-buf/dma-buf.c')
-rw-r--r--drivers/dma-buf/dma-buf.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index d504c636dc29..4c9add51f9ef 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -804,6 +804,26 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags)
EXPORT_SYMBOL_NS_GPL(dma_buf_fd, "DMA_BUF");
/**
+ * dma_buf_fd_install - install a reserved fd for a dma-buf
+ * @dmabuf: [in] pointer to dma_buf
+ * @fd: [in] fd reserved with get_unused_fd_flags()
+ *
+ * Publishes a previously reserved fd into the caller's fd table.
+ * Must only be called after all fallible work (e.g. copy_to_user)
+ * has succeeded, as it cannot be undone safely once called.
+ *
+ * The caller is responsible for having emitted the trace event
+ * (via dma_buf_fd() or get_unused_fd_flags() + this function)
+ * before calling this.
+ */
+void dma_buf_fd_install(struct dma_buf *dmabuf, int fd)
+{
+ DMA_BUF_TRACE(trace_dma_buf_fd, dmabuf, fd);
+ fd_install(fd, dmabuf->file);
+}
+EXPORT_SYMBOL_NS_GPL(dma_buf_fd_install, "DMA_BUF");
+
+/**
* dma_buf_get - returns the struct dma_buf related to an fd
* @fd: [in] fd associated with the struct dma_buf to be returned
*