pan/kmod: Fix a syncobj leak in the panthor backend

Make sure we release the syncobj attached to the BO if the object is
sharable.

Fixes: 97f6a62f7e ("pan/kmod: Add a backend for panthor")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Constantine Shablia <constantine.shablya@collabora.com>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28926>
(cherry picked from commit 068d111884)
This commit is contained in:
Boris Brezillon 2024-04-24 15:28:43 +02:00 committed by Eric Engestrom
parent ddf6f67b07
commit 1f917b8814
2 changed files with 7 additions and 1 deletions

View file

@ -64,7 +64,7 @@
"description": "pan/kmod: Fix a syncobj leak in the panthor backend",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "97f6a62f7ef82b909f62ca78788d4f24416fbd31",
"notes": null

View file

@ -309,6 +309,12 @@ err_free_bo:
static void
panthor_kmod_bo_free(struct pan_kmod_bo *bo)
{
struct panthor_kmod_bo *panthor_bo =
container_of(bo, struct panthor_kmod_bo, base);
if (!bo->exclusive_vm)
drmSyncobjDestroy(bo->dev->fd, panthor_bo->sync.handle);
drmCloseBufferHandle(bo->dev->fd, bo->handle);
pan_kmod_dev_free(bo->dev, bo);
}