]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/log: Do not hold lock across drm_client_release()
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 9 Oct 2025 13:16:29 +0000 (15:16 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 24 Oct 2025 06:45:37 +0000 (08:45 +0200)
When calling drm_client_release(), the client is already quiescent.
Internal locks should therefore be dropped before the caller releases
the client.

In the case of the DRM log, concurrency originates from the console or
from client events. The console has been unregistered in the previous
line. The caller of the unregister callback, drm_log_client_unregister(),
holds clientlist_mutex from struct drm_device to protect against concurrent
client events. It is therefore safe to release the client without holding
locks.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>>
Link: https://lore.kernel.org/r/20251009132006.45834-3-tzimmermann@suse.de
drivers/gpu/drm/clients/drm_log.c

index fd8556dd58ed8191bb6d03c1b129ae5ea9fffb17..d040be2e9d7a0876c4712facd5cc504efe67be51 100644 (file)
@@ -302,8 +302,8 @@ static void drm_log_client_unregister(struct drm_client_dev *client)
 
        mutex_lock(&dlog->lock);
        drm_log_free_scanout(client);
-       drm_client_release(client);
        mutex_unlock(&dlog->lock);
+       drm_client_release(client);
        kfree(dlog);
        drm_dbg(dev, "Unregistered with drm log\n");
 }