Re: [PATCH v2] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-06-18 Thread Navid Emamdoost
Hi Lucas, On Wed, Jun 17, 2020 at 4:53 AM Lucas Stach wrote: > > Hi Navid, > > Am Montag, den 15.06.2020, 01:12 -0500 schrieb Navid Emamdoost: > > in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs, > > and etnaviv_gpu_init the call to pm_run

[PATCH v2] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-06-15 Thread Navid Emamdoost
in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs, and etnaviv_gpu_init the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost

[PATCH] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-06-15 Thread Navid Emamdoost
in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs, and etnaviv_gpu_init the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost

Re: [PATCH] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-06-15 Thread Navid Emamdoost
On Sun, Jun 14, 2020 at 4:48 AM Andy Shevchenko wrote: > > On Sun, Jun 14, 2020 at 9:48 AM Navid Emamdoost > wrote: > > ... > > > + if (ret < 0) { > > > + pm_runtime_put(gpu->dev); > > Please, in all your patc

[PATCH] drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails

2020-06-15 Thread Navid Emamdoost
The call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 1 file changed

[PATCH] drm/vc4: fix ref count leak in vc4_dsi_encoder_enable

2020-06-15 Thread Navid Emamdoost
in vc4_dsi_encoder_enable, the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vc4/vc4_dsi.c | 10 ++ 1 file

[PATCH] drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms

2020-06-15 Thread Navid Emamdoost
in amdgpu_driver_open_kms the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++- 1 file

Re: [PATCH] drm/exynos: fix ref count leak in mic_pre_enable

2020-06-15 Thread Navid Emamdoost
On Sun, Jun 14, 2020 at 7:47 PM Inki Dae wrote: > > Hi, > > 20. 6. 14. 오후 3:23에 Navid Emamdoost 이(가) 쓴 글: > > in mic_pre_enable, pm_runtime_get_sync is called which > > increments the counter even in case of failure, leading to incorrect > > ref count. In case of fa

[PATCH] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config

2020-06-15 Thread Navid Emamdoost
in amdgpu_display_crtc_set_config, the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 5

[PATCH v2] drm/exynos: fix ref count leak in mic_pre_enable

2020-06-15 Thread Navid Emamdoost
in mic_pre_enable, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- Changes in v2: - reuse the unlock label and call

[PATCH] drm/vc4: fix ref count leak in vc4_v3d_pm_get

2020-06-15 Thread Navid Emamdoost
in vc4_v3d_pm_get, the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vc4/vc4_v3d.c | 1 + 1 file changed, 1 insertion

[PATCH] drm/panfrost: perfcnt: fix ref count leak in panfrost_perfcnt_enable_locked

2020-06-15 Thread Navid Emamdoost
in panfrost_perfcnt_enable_locked, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/panfrost/panfrost_perfcnt.c

[PATCH] drm/amd/display: fix ref count leak in amdgpu_drm_ioctl

2020-06-15 Thread Navid Emamdoost
in amdgpu_drm_ioctl the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2

[PATCH] drm/panfrost: fix ref count leak in panfrost_job_hw_submit

2020-06-15 Thread Navid Emamdoost
in panfrost_job_hw_submit, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/panfrost/panfrost_job.c | 8 +--- 1

Re: [PATCH] drm/vc4: fix ref count leak in vc4_dsi_encoder_enable

2020-06-15 Thread Navid Emamdoost
On Sun, Jun 14, 2020 at 7:32 AM Andy Shevchenko wrote: > > On Sun, Jun 14, 2020 at 9:55 AM Navid Emamdoost > wrote: > > > > in vc4_dsi_encoder_enable, the call to pm_runtime_get_sync increments > > the counter even in case of failure, leading to incorrect > &

[PATCH] drm/vc4: fix ref count leak in vc4_vec_encoder_enable

2020-06-15 Thread Navid Emamdoost
in vc4_vec_encoder_enable, the call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vc4/vc4_vec.c | 8 +--- 1 file changed

[PATCH] drm/exynos: fix ref count leak in mic_pre_enable

2020-06-15 Thread Navid Emamdoost
in mic_pre_enable, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/exynos/exynos_drm_mic.c | 2 +- 1 file changed

Re: [PATCH] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add

2019-12-11 Thread Navid Emamdoost
ping ... On Thu, Nov 21, 2019 at 12:17 PM Navid Emamdoost wrote: > > On Tue, Sep 24, 2019 at 11:38 PM Navid Emamdoost > wrote: > > > > In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory > > for cres should be released. > > > > Signed

Re: [PATCH] drm/nouveau: Fix memory leak in nouveau_bo_alloc

2019-12-11 Thread Navid Emamdoost
ping ... On Tue, Nov 26, 2019 at 11:50 AM Navid Emamdoost wrote: > > ping... > > On Thu, Nov 21, 2019 at 12:09 PM Navid Emamdoost > wrote: > > > > On Mon, Oct 21, 2019 at 4:14 PM Navid Emamdoost > > wrote: > > > > > > In the implementa

Re: [PATCH] drm/nouveau: Fix memory leak in nouveau_bo_alloc

2019-11-27 Thread Navid Emamdoost
ping... On Thu, Nov 21, 2019 at 12:09 PM Navid Emamdoost wrote: > > On Mon, Oct 21, 2019 at 4:14 PM Navid Emamdoost > wrote: > > > > In the implementation of nouveau_bo_alloc() if it fails to determine the > > target page size via pi, then the allocated memory for

[PATCH] dma-buf: Fix memory leak in sync_file_merge()

2019-11-25 Thread Navid Emamdoost
In the implementation of sync_file_merge() the allocated sync_file is leaked if number of fences overflows. Release sync_file by goto err. Fixes: a02b9dc90d84 ("dma-buf/sync_file: refactor fence storage in struct sync_file") Signed-off-by: Navid Emamdoost --- drivers/dma-buf/sync_

Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind

2019-11-25 Thread Navid Emamdoost
Thanks for the update. On Fri, Nov 22, 2019 at 1:22 AM Marco Felsch wrote: > > Hi Navid, > > On 19-11-21 12:31, Navid Emamdoost wrote: > > On Fri, Oct 4, 2019 at 2:09 PM Navid Emamdoost > > wrote: > > > > > > In imx_pd_bind, the duplicated

Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind

2019-11-22 Thread Navid Emamdoost
On Fri, Oct 4, 2019 at 2:09 PM Navid Emamdoost wrote: > > In imx_pd_bind, the duplicated memory for imxpd->edid via kmemdup should > be released in drm_of_find_panel_or_bridge or imx_pd_register fail. > > Fixes: ebc944613567 ("drm: convert drivers to use > drm_of_find

Re: [PATCH] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add

2019-11-22 Thread Navid Emamdoost
On Tue, Sep 24, 2019 at 11:38 PM Navid Emamdoost wrote: > > In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory > for cres should be released. > > Signed-off-by: Navid Emamdoost Would you please review this patch? Thanks, > --- > drivers/gpu/drm/vmwgf

Re: [PATCH] drm/nouveau: Fix memory leak in nouveau_bo_alloc

2019-11-22 Thread Navid Emamdoost
On Mon, Oct 21, 2019 at 4:14 PM Navid Emamdoost wrote: > > In the implementation of nouveau_bo_alloc() if it fails to determine the > target page size via pi, then the allocated memory for nvbo should be > released. > > Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM o

[PATCH] drm/tinydrm: Fix memroy leak in hx8357d_probe

2019-10-28 Thread Navid Emamdoost
: Add an hx8367d tinydrm driver.") Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/tiny/hx8357d.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c index 9af8ff84974f..da5ec944f

Re: [PATCH] drm/v3d: Fix memory leak in v3d_submit_cl_ioctl

2019-10-22 Thread Navid Emamdoost
On Tue, Oct 22, 2019 at 4:36 AM Daniel Vetter wrote: > > On Mon, Oct 21, 2019 at 01:52:49PM -0500, Navid Emamdoost wrote: > > In the impelementation of v3d_submit_cl_ioctl() there are two memory > > leaks. One is when allocation for bin fails, and the other is when bin > &

[PATCH] drm/amdgpu: Fix memory leak in amdgpu_fence_emit

2019-10-21 Thread Navid Emamdoost
In the impelementation of amdgpu_fence_emit() if dma_fence_wait() fails and returns an errno, before returning the allocated memory for fence should be released. Fixes: 3d2aca8c8620 ("drm/amdgpu: fix old fence check in amdgpu_fence_emit") Signed-off-by: Navid Emamdoost --- drivers/g

[PATCH] drm/nouveau: Fix memory leak in nouveau_bo_alloc

2019-10-21 Thread Navid Emamdoost
In the implementation of nouveau_bo_alloc() if it fails to determine the target page size via pi, then the allocated memory for nvbo should be released. Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object") Signed-off-by: Navid Emamdoost --- drivers/gpu/d

[PATCH] drm/v3d: Fix memory leak in v3d_submit_cl_ioctl

2019-10-21 Thread Navid Emamdoost
t;base then allocated memory for bin should be released. Fixes: a783a09ee76d ("drm/v3d: Refactor job management.") Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/v3d/v3d_gem.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/dri

Re: [PATCH 1/2] drm/imx: Fix error handling for a kmemdup() call in imx_pd_bind()

2019-10-14 Thread Navid Emamdoost
On Sat, Oct 12, 2019 at 4:07 AM Markus Elfring wrote: > > From: Markus Elfring > Date: Sat, 12 Oct 2019 10:30:21 +0200 > > The return value from a call of the function “kmemdup” was not checked > in this function implementation. Thus add the corresponding error handling. > > Fixes:

Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind

2019-10-12 Thread Navid Emamdoost
No, that is not correct! You should not try to free imxpd here as it is a resource-managed allocation via devm_kzalloc(). It means memory allocated with this function is automatically freed on driver detach. So, this patch introduces a double-free. On Sat, Oct 12, 2019 at 6:54 AM Markus Elfring

Re: drm/imx: Checking a kmemdup() call in imx_pd_bind()

2019-10-06 Thread Navid Emamdoost
Hi Markus, I agree with you, kmemdup may fail so a null check seems necessary there. On Sun, Oct 6, 2019 at 4:33 AM Markus Elfring wrote: > > I have taken another look also at the implementation of the function > “imx_pd_bind”. >

[PATCH] drm/imx: fix memory leak in imx_pd_bind

2019-10-04 Thread Navid Emamdoost
el display support") Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/imx/parallel-display.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index e7ce17503ae1..9522d2cb0ad5 100644 --

Re: [PATCH] drm/amd/display: memory leak

2019-10-02 Thread Navid Emamdoost
Would you please review this patch? Thanks, Navid. On Mon, Sep 16, 2019 at 10:21 PM Navid Emamdoost wrote: > > In dcn*_clock_source_create when dcn20_clk_src_construct fails allocated > clk_src needs release. > > Signed-off-by: Navid Emamdoost > --- > drivers/gpu/drm/

[PATCH v4] drm/amdgpu: fix multiple memory leaks in acp_hw_init

2019-10-02 Thread Navid Emamdoost
g_devices or pm_genpd_add_device fail. 3- Release is needed in case of time out values expire. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 34 - 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu

Re: [PATCH v3] drm/amdgpu: fix multiple memory leaks in acp_hw_init

2019-10-02 Thread Navid Emamdoost
On Tue, Oct 1, 2019 at 7:19 AM Koenig, Christian wrote: > > Am 30.09.19 um 23:26 schrieb Navid Emamdoost: > > In acp_hw_init there are some allocations that needs to be released in > > case of failure: > > > > 1- adev->acp.acp_genpd should be released if a

[PATCH v3] drm/amdgpu: fix multiple memory leaks in acp_hw_init

2019-10-01 Thread Navid Emamdoost
g_devices or pm_genpd_add_device fail. 3- Release is needed in case of time out values expire. Signed-off-by: Navid Emamdoost --- Changes in v2: -- moved the releases under goto Changes in v3: -- fixed multiple goto issue -- added goto for 3 other failure cases:

Re: [PATCH v2] drm/amdgpu: fix multiple memory leaks

2019-10-01 Thread Navid Emamdoost
On Thu, Sep 19, 2019 at 3:03 AM Koenig, Christian wrote: > > Am 18.09.19 um 21:05 schrieb Navid Emamdoost: > > In acp_hw_init there are some allocations that needs to be released in > > case of failure: > > > > 1- adev->acp.acp_genpd should be released if a

[PATCH] Staging: fbtft: fix memory leak in fbtft_framebuffer_alloc

2019-09-29 Thread Navid Emamdoost
Signed-off-by: Navid Emamdoost --- drivers/staging/fbtft/fbtft-core.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index cf5700a2ea66..a0a67aa517f0 100644 --- a/drivers/staging/fbtft/fbtft-co

[PATCH] drm/amd/display: prevent memory leak

2019-09-25 Thread Navid Emamdoost
In dcn*_create_resource_pool the allocated memory should be released if construct pool fails. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dce112

[PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define

2019-09-24 Thread Navid Emamdoost
In vmw_context_define if vmw_context_init fails the allocated resource should be unreferenced. The goto label was fixed. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx

[PATCH] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add

2019-09-24 Thread Navid Emamdoost
In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory for cres should be released. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b

[PATCH] drm/komeda: prevent memory leak in komeda_wb_connector_add

2019-09-24 Thread Navid Emamdoost
In komeda_wb_connector_add if drm_writeback_connector_init fails the allocated memory for kwb_conn should be released. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu

[PATCH] drm/amdgpu: release allocated memory

2019-09-23 Thread Navid Emamdoost
In amdgpu_vmid_grab_idle, fences is being leaked in one execution path. The missing kfree was added. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd

[PATCH v2] drm/amdgpu: fix multiple memory leaks

2019-09-19 Thread Navid Emamdoost
ails. v2: moved the released into goto error handlings Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 30 + 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/a

Re: [PATCH] drm/amdgpu: fix multiple memory leaks

2019-09-19 Thread Navid Emamdoost
Thanks Christian for the feedback, I'll send a v2. On Wed, Sep 18, 2019 at 12:31 PM Koenig, Christian wrote: > Am 18.09.19 um 18:09 schrieb Navid Emamdoost: > > In acp_hw_init there are some allocations that needs to be released in > > case of failure: > > > > 1-

[PATCH] drm/amdgpu: fix multiple memory leaks

2019-09-19 Thread Navid Emamdoost
ice fails. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index eba42c752bca..dd3fa85b11c5 100644 --- a/driver

[PATCH] drm/amd/display: memory leak

2019-09-17 Thread Navid Emamdoost
In dcn*_clock_source_create when dcn20_clk_src_construct fails allocated clk_src needs release. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 3 ++- drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 1 + drivers/gpu/drm/amd/display/dc

[PATCH v2] drm/panel: check failure cases in the probe func

2019-07-25 Thread Navid Emamdoost
The following function calls may fail and return NULL, so the null check is added. of_graph_get_next_endpoint of_graph_get_remote_port_parent of_graph_get_remote_port Update: Thanks to Sam Ravnborg, for suggession on the use of goto to avoid leaking endpoint. Signed-off-by: Navid Emamdoost

[PATCH] drm/panel: check failure cases in the probe func

2019-07-24 Thread Navid Emamdoost
The following function calls may fail and return NULL, so the null check is added. of_graph_get_next_endpoint of_graph_get_remote_port_parent of_graph_get_remote_port Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 9 + 1 file changed, 9

[PATCH] rpi_touchscreen_probe: check for failure case

2019-07-23 Thread Navid Emamdoost
of_graph_get_next_endpoint may return NULL, so null check is needed. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel