On Wed, Jul 29, 2026 at 11:27 PM Baineng Shou <[email protected]> wrote:
>
> drm_gem_prime_handle_to_fd() open-codes fd reservation and install
> using get_unused_fd_flags() + fd_install() directly.  This bypasses
> the DMA_BUF_TRACE() call that dma_buf_fd() emits, so observability
> tools relying on the trace_dma_buf_fd tracepoint silently miss all
> DRM PRIME exports.
>
> Replace the bare fd_install() with dma_buf_fd_install(), which wraps
> fd_install() together with DMA_BUF_TRACE(), restoring full tracepoint
> coverage.  No functional change; the fd lifecycle (get_unused_fd_flags
> → work → install) is already correct.
>
> Note: this patch depends on dma_buf_fd_install() introduced in
> "dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds"
> [1].
>
> [1] 
> https://lore.kernel.org/dri-devel/[email protected]/
>
> Suggested-by: Christian König <[email protected]>
> Signed-off-by: Baineng Shou <[email protected]>

Reviewed-by: T.J. Mercier <[email protected]>

> ---
>  drivers/gpu/drm/drm_prime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 9b44c78cd77f..fe3436d1235d 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -524,7 +524,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
>                 return PTR_ERR(dmabuf);
>         }
>
> -       fd_install(fd, dmabuf->file);
> +       dma_buf_fd_install(dmabuf, fd);
>         *prime_fd = fd;
>         return 0;
>  }
> --
> 2.34.1
>

Reply via email to