Re: [PATCH] drm/amd/display: Free local data after use

2021-03-15 Thread Rodrigo Siqueira
Applied to amd-staging-drm-next.

Thanks

On 03/11, Victor Lu wrote:
> Fixes the following memory leak in dc_link_construct():
> 
> unreferenced object 0xa03e81471400 (size 1024):
> comm "amd_module_load", pid 2486, jiffies 4294946026 (age 10.544s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> backtrace:
> [<0bdf5c4a>] kmem_cache_alloc_trace+0x30a/0x4a0
> [] link_create+0xce/0xac0 [amdgpu]
> [<2fb6c072>] dc_create+0x370/0x720 [amdgpu]
> [<0094d1f3>] amdgpu_dm_init+0x18e/0x17a0 [amdgpu]
> [] dm_hw_init+0x12/0x20 [amdgpu]
> [] amdgpu_device_init+0x1463/0x1e60 [amdgpu]
> [<32d3bb13>] amdgpu_driver_load_kms+0x5b/0x330 [amdgpu]
> [] amdgpu_pci_probe+0x192/0x280 [amdgpu]
> [] local_pci_probe+0x47/0xa0
> [<55dbbfa7>] pci_device_probe+0xe3/0x180
> [<815da970>] really_probe+0x1c4/0x4e0
> [] driver_probe_device+0x62/0x150
> [<0f9ecc61>] device_driver_attach+0x58/0x60
> [<0f65c843>] __driver_attach+0xd6/0x150
> [<2f5e3683>] bus_for_each_dev+0x6a/0xc0
> [] driver_attach+0x1e/0x20
> 
> Fixes: a8e30005b47a ("drm/amd/display/dc/core/dc_link: Move some local
> data from the stack to the heap")
> Signed-off-by: Victor Lu 
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> index 9337e87a73e7..b60e0a4dc4bc 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> @@ -1615,6 +1615,7 @@ static bool dc_link_construct(struct dc_link *link,
>   link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
>  
>   DC_LOG_DC("BIOS object table - %s finished successfully.\n", __func__);
> + kfree(info);
>   return true;
>  device_tag_fail:
>   link->link_enc->funcs->destroy(>link_enc);
> -- 
> 2.25.1
> 

-- 
Rodrigo Siqueira
https://siqueira.tech


signature.asc
Description: PGP signature
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/display: Free local data after use

2021-03-15 Thread Rodrigo Siqueira
Nice catch!

Reviewed-by: Rodrigo Siqueira 

On 03/11, Victor Lu wrote:
> Fixes the following memory leak in dc_link_construct():
> 
> unreferenced object 0xa03e81471400 (size 1024):
> comm "amd_module_load", pid 2486, jiffies 4294946026 (age 10.544s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> backtrace:
> [<0bdf5c4a>] kmem_cache_alloc_trace+0x30a/0x4a0
> [] link_create+0xce/0xac0 [amdgpu]
> [<2fb6c072>] dc_create+0x370/0x720 [amdgpu]
> [<0094d1f3>] amdgpu_dm_init+0x18e/0x17a0 [amdgpu]
> [] dm_hw_init+0x12/0x20 [amdgpu]
> [] amdgpu_device_init+0x1463/0x1e60 [amdgpu]
> [<32d3bb13>] amdgpu_driver_load_kms+0x5b/0x330 [amdgpu]
> [] amdgpu_pci_probe+0x192/0x280 [amdgpu]
> [] local_pci_probe+0x47/0xa0
> [<55dbbfa7>] pci_device_probe+0xe3/0x180
> [<815da970>] really_probe+0x1c4/0x4e0
> [] driver_probe_device+0x62/0x150
> [<0f9ecc61>] device_driver_attach+0x58/0x60
> [<0f65c843>] __driver_attach+0xd6/0x150
> [<2f5e3683>] bus_for_each_dev+0x6a/0xc0
> [] driver_attach+0x1e/0x20
> 
> Fixes: a8e30005b47a ("drm/amd/display/dc/core/dc_link: Move some local
> data from the stack to the heap")
> Signed-off-by: Victor Lu 
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> index 9337e87a73e7..b60e0a4dc4bc 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> @@ -1615,6 +1615,7 @@ static bool dc_link_construct(struct dc_link *link,
>   link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
>  
>   DC_LOG_DC("BIOS object table - %s finished successfully.\n", __func__);
> + kfree(info);
>   return true;
>  device_tag_fail:
>   link->link_enc->funcs->destroy(>link_enc);
> -- 
> 2.25.1
> 

-- 
Rodrigo Siqueira
https://siqueira.tech


signature.asc
Description: PGP signature
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/display: Free local data after use

2021-03-11 Thread Victor Lu
Fixes the following memory leak in dc_link_construct():

unreferenced object 0xa03e81471400 (size 1024):
comm "amd_module_load", pid 2486, jiffies 4294946026 (age 10.544s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
backtrace:
[<0bdf5c4a>] kmem_cache_alloc_trace+0x30a/0x4a0
[] link_create+0xce/0xac0 [amdgpu]
[<2fb6c072>] dc_create+0x370/0x720 [amdgpu]
[<0094d1f3>] amdgpu_dm_init+0x18e/0x17a0 [amdgpu]
[] dm_hw_init+0x12/0x20 [amdgpu]
[] amdgpu_device_init+0x1463/0x1e60 [amdgpu]
[<32d3bb13>] amdgpu_driver_load_kms+0x5b/0x330 [amdgpu]
[] amdgpu_pci_probe+0x192/0x280 [amdgpu]
[] local_pci_probe+0x47/0xa0
[<55dbbfa7>] pci_device_probe+0xe3/0x180
[<815da970>] really_probe+0x1c4/0x4e0
[] driver_probe_device+0x62/0x150
[<0f9ecc61>] device_driver_attach+0x58/0x60
[<0f65c843>] __driver_attach+0xd6/0x150
[<2f5e3683>] bus_for_each_dev+0x6a/0xc0
[] driver_attach+0x1e/0x20

Fixes: a8e30005b47a ("drm/amd/display/dc/core/dc_link: Move some local
data from the stack to the heap")
Signed-off-by: Victor Lu 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 9337e87a73e7..b60e0a4dc4bc 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1615,6 +1615,7 @@ static bool dc_link_construct(struct dc_link *link,
link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
 
DC_LOG_DC("BIOS object table - %s finished successfully.\n", __func__);
+   kfree(info);
return true;
 device_tag_fail:
link->link_enc->funcs->destroy(>link_enc);
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx