Skip to content

Commit 623b438

Browse files
thejhigorpecovnik
authored andcommitted
drm/panthor: Fix memory leak in panthor_ioctl_group_create()
When bailing out due to group_priority_permit() failure, the queue_args need to be freed. Fix it by rearranging the function to use the goto-on-error pattern, such that the success case flows straight without indentation while error cases jump forward to cleanup. Cc: stable@vger.kernel.org Fixes: 5f77620 ("drm/panthor: Restrict high priorities on group_create") Signed-off-by: Jann Horn <jannh@google.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20241113-panthor-fix-gcq-bailout-v1-1-654307254d68@google.com
1 parent 401347d commit 623b438

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/gpu/drm/panthor/panthor_drv.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,14 +1102,15 @@ static int panthor_ioctl_group_create(struct drm_device *ddev, void *data,
11021102

11031103
ret = group_priority_permit(file, args->priority);
11041104
if (ret)
1105-
return ret;
1105+
goto out;
11061106

11071107
ret = panthor_group_create(pfile, args, queue_args);
1108-
if (ret >= 0) {
1109-
args->group_handle = ret;
1110-
ret = 0;
1111-
}
1108+
if (ret < 0)
1109+
goto out;
1110+
args->group_handle = ret;
1111+
ret = 0;
11121112

1113+
out:
11131114
kvfree(queue_args);
11141115
return ret;
11151116
}

0 commit comments

Comments
 (0)