gpu:nvgpu: fix below issue with ctrl nvs.

- Move queue lock at correct place.
- Free the allocated memory.

Jira NVGPU-8622

Change-Id: Ia996d80498e53fb21ddf1f1202abd6fb8e3f6168
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2791618
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
prsethi
2022-10-13 17:00:57 +00:00
committed by mobile promotions
parent 5c8e511e48
commit de0808ea5b
3 changed files with 4 additions and 3 deletions

View File

@@ -41,7 +41,7 @@
/* /*
* Keep it to page size for now. Can be updated later. * Keep it to page size for now. Can be updated later.
*/ */
#define NVS_QUEUE_DEFAULT_SIZE (64 * 1024) #define NVS_QUEUE_DEFAULT_SIZE (64U * 1024U)
struct gk20a; struct gk20a;
struct nvgpu_nvs_domain_ioctl; struct nvgpu_nvs_domain_ioctl;

View File

@@ -85,6 +85,7 @@ static int nvs_release_user_mappings_locked(struct gk20a *g, struct nvgpu_nvs_li
zap_vma_entries(g, vma); zap_vma_entries(g, vma);
linux_buf->mapped_ref--; linux_buf->mapped_ref--;
nvgpu_kfree(g, current_entry);
} }
return err; return err;

View File

@@ -947,14 +947,14 @@ static int nvgpu_nvs_ctrl_fifo_destroy_queue(struct gk20a *g,
} }
} }
nvgpu_nvs_ctrl_fifo_lock_queues(g);
queue = nvgpu_nvs_ctrl_fifo_get_queue(g->sched_ctrl_fifo, num_queue, queue_direction, &mask); queue = nvgpu_nvs_ctrl_fifo_get_queue(g->sched_ctrl_fifo, num_queue, queue_direction, &mask);
if (queue == NULL) { if (queue == NULL) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto fail; goto fail;
} }
nvgpu_nvs_ctrl_fifo_lock_queues(g);
if (!nvgpu_nvs_ctrl_fifo_user_is_subscribed_to_queue(user, queue)) { if (!nvgpu_nvs_ctrl_fifo_user_is_subscribed_to_queue(user, queue)) {
err = -EPERM; err = -EPERM;
goto fail; goto fail;