msm: kgsl: Fix memory leak in kgsl_ioctl_recurring_command()

Currently, profiling flag for recurring command is cleared after
adding a profiling buffer command object. When command object
destroy is called, it won't put refcount for this profiling buffer
as the flag was cleared earlier resulting in a memory leak. Clear
the profiling flag immediately after draw object creation to avoid
refcount on profiling buffer.

Change-Id: I3b56087d4e18404a19d3ffc429febdf055765f35
Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>
This commit is contained in:
Kamal Agrawal 2022-02-27 02:21:05 +05:30 committed by Gerrit - the friendly Code Review server
parent e854c0a3ce
commit 4cb83057d4

6
kgsl.c
View File

@ -2258,6 +2258,9 @@ long kgsl_ioctl_recurring_command(struct kgsl_device_private *dev_priv,
drawobj = DRAWOBJ(cmdobj); drawobj = DRAWOBJ(cmdobj);
/* Clear the profiling flag for recurring command */
drawobj->flags &= ~(unsigned long)KGSL_DRAWOBJ_PROFILING;
result = kgsl_drawobj_cmd_add_cmdlist(device, cmdobj, result = kgsl_drawobj_cmd_add_cmdlist(device, cmdobj,
u64_to_user_ptr(param->cmdlist), u64_to_user_ptr(param->cmdlist),
param->cmdsize, param->numcmds); param->cmdsize, param->numcmds);
@ -2270,9 +2273,6 @@ long kgsl_ioctl_recurring_command(struct kgsl_device_private *dev_priv,
if (result) if (result)
goto done; goto done;
/* Clear the profiling flag for recurring command */
drawobj->flags &= ~(unsigned long)KGSL_DRAWOBJ_PROFILING;
if (drawobj->flags & KGSL_DRAWOBJ_STOP_RECURRING) { if (drawobj->flags & KGSL_DRAWOBJ_STOP_RECURRING) {
result = device->ftbl->dequeue_recurring_cmd(device, context); result = device->ftbl->dequeue_recurring_cmd(device, context);
if (!result) if (!result)