drm/amdgpu: fix potential memory leak during navi12 deinitialization
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix potential memory leak during navi12 deinitialization
Navi12 HDCP & DTM deinitialization needs continue to free bo if already created though initialized flag is not set.
Signed-off-by Jiawei Gu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +14 -4
@@ -1316,8 +1316,12 @@ static int psp_hdcp_terminate(struct psp_context *psp)if (amdgpu_sriov_vf (psp->adev))return 0 ; -if (!psp->hdcp_context.hdcp_initialized) -return 0 ; +if (!psp->hdcp_context.hdcp_initialized) { +if (psp->hdcp_context.hdcp_shared_buf) + goto out; +else +return 0 ; + } ret =psp_hdcp_unload (psp);if (ret)
@@ -1325,6 +1329,7 @@ static int psp_hdcp_terminate(struct psp_context *psp) psp->hdcp_context.hdcp_initialized = false; +out:/* free hdcp shared memory */ amdgpu_bo_free_kernel(&psp->hdcp_context.hdcp_shared_bo, &psp->hdcp_context.hdcp_shared_mc_addr,
@@ -1463,8 +1468,12 @@ static int psp_dtm_terminate(struct psp_context *psp)if (amdgpu_sriov_vf (psp->adev))return 0 ; -if (!psp->dtm_context.dtm_initialized) -return 0 ; +if (!psp->dtm_context.dtm_initialized) { +if (psp->dtm_context.dtm_shared_buf) + goto out; +else +return 0 ; + } ret =psp_dtm_unload (psp);if (ret)
@@ -1472,6 +1481,7 @@ static int psp_dtm_terminate(struct psp_context *psp) psp->dtm_context.dtm_initialized = false; +out:/* free hdcp shared memory */ amdgpu_bo_free_kernel(&psp->dtm_context.dtm_shared_bo, &psp->dtm_context.dtm_shared_mc_addr,
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Jiawei Gu
Navi12 HDCP & DTM deinitialization needs continue to free bo if already created though initialized flag is not set.
Signed-off-by Jiawei Gu <[email protected]>
Reviewed-by Alex Deucher <[email protected]>
Quoted 57 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +14
-5@@ -1316,8 +1316,12 @@ static int psp_hdcp_terminate(struct psp_context *psp)if (amdgpu_sriov_vf (psp->adev))return 0 ; -if (!psp->hdcp_context.hdcp_initialized) -return 0 ; +if (!psp->hdcp_context.hdcp_initialized) { +if (psp->hdcp_context.hdcp_shared_buf) + goto out; +else +return 0 ; + } ret =psp_hdcp_unload (psp);if (ret)@@ -1325,6 +1329,7 @@ static int psp_hdcp_terminate(struct psp_context *psp) psp->hdcp_context.hdcp_initialized = false; +out:/* free hdcp shared memory */ amdgpu_bo_free_kernel(&psp->hdcp_context.hdcp_shared_bo, &psp->hdcp_context.hdcp_shared_mc_addr,@@ -1463,8 +1468,12 @@ static int psp_dtm_terminate(struct psp_context *psp)if (amdgpu_sriov_vf (psp->adev))return 0 ; -if (!psp->dtm_context.dtm_initialized) -return 0 ; +if (!psp->dtm_context.dtm_initialized) { +if (psp->dtm_context.dtm_shared_buf) + goto out; +else +return 0 ; + } ret =psp_dtm_unload (psp);if (ret)@@ -1472,6 +1481,7 @@ static int psp_dtm_terminate(struct psp_context *psp) psp->dtm_context.dtm_initialized = false; +out:/* free hdcp shared memory */ amdgpu_bo_free_kernel(&psp->dtm_context.dtm_shared_bo, &psp->dtm_context.dtm_shared_mc_addr, --2.17.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx