gpu: nvgpu: Decrement CSS dmabuf ref cnt before ret

The function gk20a_channel_cycle_stats does not decrement the
dmabuf refcnt if vmapping it fails. This patch fixes it by
decrementing the ref cnt before returning.

NVGPU-397
NVGPU-415

Change-Id: Iae01ada710adb04fd4e4ba0371eccec5f8765254
Signed-off-by: Martin Radev <mradev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2527190
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Martin Radev
2021-05-10 14:45:22 +03:00
committed by mobile promotions
parent d2349b32ec
commit d1983f5cfa

View File

@@ -179,8 +179,10 @@ int gk20a_channel_cycle_stats(struct nvgpu_channel *ch, int dmabuf_fd)
#else
virtual_address = dma_buf_vmap(dmabuf);
#endif
if (!virtual_address)
if (!virtual_address) {
dma_buf_put(dmabuf);
return -ENOMEM;
}
priv->cyclestate_buffer_handler = dmabuf;
ch->cyclestate.cyclestate_buffer = virtual_address;