mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
- During driver unload, shutdown or RG path as part of pmu destroy, pmu sequences have to be cleaned up to free payload memory and allocation info which is stored as part of pmu_sequence. - While doing so there can be race condition with pmu_isr or nvgpu_pmu_rpc_execute path where it waits for fw ack. - This race condition can lead to freeing of payload memory before nvgpu_pmu_sequences_cleanup() does. - This can lead to memory corruption or double free issue when the cleanup code again tries to free the payload mem. - To resolve this add a new function nvgpu_pmu_seq_free_release() which will check for seq->id in pmu seq tbl before freeing the memory and other info from pmu_sequence. - Use this nvgpu_pmu_seq_free_release() in non-blocking RPC calls and also when fw ack fails or driver is dying scenario. - For blocking call, synchronise freeing of rpc payload memory by using a new boolean seq_free_status. Bug 4019694 Bug 4059157 Change-Id: Id45a6914a2d383a654539a87861c471a77fb6850 Signed-off-by: Divya <dsinghatwari@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2882210 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>