[PATCH] rust: drm: device: drop_in_place() the drm::Device in release()

Danilo Krummrich dakr at kernel.org
Thu Jul 3 22:42:46 UTC 2025


On Sun, Jun 29, 2025 at 05:37:42PM +0200, Danilo Krummrich wrote:
> In drm::Device::new() we allocate with __drm_dev_alloc() and return an
> ARef<drm::Device>.
> 
> When the reference count of the drm::Device falls to zero, the C code
> automatically calls drm_dev_release(), which eventually frees the memory
> allocated in drm::Device::new().
> 
> However, due to that, drm::Device::drop() is never called. As a result
> the destructor of the user's private data, i.e. drm::Device::data is
> never called. Hence, fix this by calling drop_in_place() from the DRM
> device's release callback.
> 
> Fixes: 1e4b8896c0f3 ("rust: drm: add device abstraction")
> Signed-off-by: Danilo Krummrich <dakr at kernel.org>

Applied to drm-misc-fixes, thanks!


More information about the dri-devel mailing list