Commit 55c1c4ca23d0f2736ef7c219d0fb005323ff8ee0

Authored by Dave Airlie
Committed by Sumit Semwal
1 parent 33ea2dcb39

dma-buf: pass flags into dma_buf_fd.

We need to pass the flags into dma_buf_fd at this point,
so the flags end up doing the right thing for O_CLOEXEC.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>

Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff

drivers/base/dma-buf.c
... ... @@ -107,17 +107,18 @@
107 107 /**
108 108 * dma_buf_fd - returns a file descriptor for the given dma_buf
109 109 * @dmabuf: [in] pointer to dma_buf for which fd is required.
  110 + * @flags: [in] flags to give to fd
110 111 *
111 112 * On success, returns an associated 'fd'. Else, returns error.
112 113 */
113   -int dma_buf_fd(struct dma_buf *dmabuf)
  114 +int dma_buf_fd(struct dma_buf *dmabuf, int flags)
114 115 {
115 116 int error, fd;
116 117  
117 118 if (!dmabuf || !dmabuf->file)
118 119 return -EINVAL;
119 120  
120   - error = get_unused_fd();
  121 + error = get_unused_fd_flags(flags);
121 122 if (error < 0)
122 123 return error;
123 124 fd = error;
include/linux/dma-buf.h
... ... @@ -117,7 +117,7 @@
117 117 struct dma_buf_attachment *dmabuf_attach);
118 118 struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
119 119 size_t size, int flags);
120   -int dma_buf_fd(struct dma_buf *dmabuf);
  120 +int dma_buf_fd(struct dma_buf *dmabuf, int flags);
121 121 struct dma_buf *dma_buf_get(int fd);
122 122 void dma_buf_put(struct dma_buf *dmabuf);
123 123