On Tue, Oct 13, 2026 at 5:02 AM Matt Evans <[email protected]> wrote:
>
> 4ab59c3c638c6 ("dma-buf: Move dma_buf_release() from fops to
> dentry_ops") moved the dmabuf .release, and broke the vmwgfx driver's
> assumption that dmabuf->file would remain valid until release.
> Currently, dmabuf->file can be stale after the file closes even if
> .release has not yet been called, and a future commit makes
> dmabuf->file become NULL instead of stale.
>
> In preparation for that future commit, convert
> get_dma_buf_unless_doomed() to use get_file_active(&dmabuf->file)
> which is the safe method to access and get a reference, even when
> dmabuf->file could be NULL.
>
> Cc: [email protected]
> Fixes: 4ab59c3c638c6 ("dma-buf: Move dma_buf_release() from fops to 
> dentry_ops")
> Signed-off-by: Matt Evans <[email protected]>
> ---
>  drivers/gpu/drm/vmwgfx/ttm_object.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/ttm_object.c 
> b/drivers/gpu/drm/vmwgfx/ttm_object.c
> index f9042bafdc93..9137a31eaa1a 100644
> --- a/drivers/gpu/drm/vmwgfx/ttm_object.c
> +++ b/drivers/gpu/drm/vmwgfx/ttm_object.c
> @@ -471,7 +471,7 @@ void ttm_object_device_release(struct ttm_object_device 
> **p_tdev)
>   */
>  static bool __must_check get_dma_buf_unless_doomed(struct dma_buf *dmabuf)
>  {
> -       return file_ref_get(&dmabuf->file->f_ref);
> +       return get_file_active(&dmabuf->file) != NULL;
>  }
>
>  /**
> --
> 2.47.3

Looks good. Thanks! Feel free to use either Suggested-by or
Reviewed-by: Zack Rusin <[email protected]>

z

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to