From: Matt Evans <matt@ozlabs.org>
To: "Christian König" <christian.koenig@amd.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Zack Rusin" <zack.rusin@broadcom.com>,
"Zhenyu Wang" <zhenyuw.linux@gmail.com>,
"Zhi Wang" <zhi.wang.linux@gmail.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>
Cc: intel-gfx@lists.freedesktop.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
linux-kernel@vger.kernel.org, Alex Mastro <amastro@fb.com>,
Alex Williamson <alex@shazbot.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v3 1/3] drm/vmwgfx: Use get_file_active() for dmabuf->file
Date: Tue, 13 Oct 2026 13:02:04 +0100 [thread overview]
Message-ID: <20261013120211.135807-2-matt@ozlabs.org> (raw)
In-Reply-To: <20261013120211.135807-1-matt@ozlabs.org>
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: stable@vger.kernel.org
Fixes: 4ab59c3c638c6 ("dma-buf: Move dma_buf_release() from fops to dentry_ops")
Signed-off-by: Matt Evans <matt@ozlabs.org>
---
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
next prev parent reply other threads:[~2026-10-13 12:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 12:02 [PATCH v3 0/3] dma-buf: dmabuf->file release-time cleanup Matt Evans
2026-10-13 12:02 ` Matt Evans [this message]
2026-10-15 16:42 ` [PATCH v3 1/3] drm/vmwgfx: Use get_file_active() for dmabuf->file Zack Rusin
2026-10-13 12:02 ` [PATCH v3 2/3] drm/i915/gvt: Read dmabuf->file only while valid Matt Evans
2026-10-15 5:25 ` Zhenyu Wang
2026-10-13 12:02 ` [PATCH v3 3/3] dma-buf: Annul dmabuf->file on file release Matt Evans
2026-10-13 12:13 ` Christian König
2026-10-15 16:45 ` Zack Rusin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261013120211.135807-2-matt@ozlabs.org \
--to=matt@ozlabs.org \
--cc=airlied@gmail.com \
--cc=alex@shazbot.org \
--cc=amastro@fb.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.com \
--cc=zhenyuw.linux@gmail.com \
--cc=zhi.wang.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®