Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/client: Do not free client memory by default

Make no assumption on the allocation of the client's memory. For
example, amdgpu stores a client within another data structures,
where it cannot be freed by itself.

The correct place to free the client's memory is the client's free
callback. All existing clients implement this.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20251009132006.45834-5-tzimmermann@suse.de

+5 -4
+5 -4
drivers/gpu/drm/drm_client_event.c
··· 39 39 mutex_lock(&dev->clientlist_mutex); 40 40 list_for_each_entry_safe(client, tmp, &dev->clientlist, list) { 41 41 list_del(&client->list); 42 - if (client->funcs && client->funcs->unregister) { 42 + /* 43 + * Unregistering consumes and frees the client. 44 + */ 45 + if (client->funcs && client->funcs->unregister) 43 46 client->funcs->unregister(client); 44 - } else { 47 + else 45 48 drm_client_release(client); 46 - kfree(client); 47 - } 48 49 } 49 50 mutex_unlock(&dev->clientlist_mutex); 50 51 }