From a44ed47cf4f6c6cd09ebb43e147e4846c5e62b66 Mon Sep 17 00:00:00 2001 From: Surbhi Singh Date: Mon, 18 Nov 2024 09:04:05 +0000 Subject: [PATCH] video: tegra: nvmap: Fix INT30-C overflow defects Add check for overflow in nvmap_handle.c when two unsigned integers are added and return error in case of overflow condition. JIRA: TMM-5724 Bug 4479044 Change-Id: I0f9075796d944cc0c28db15cc611df8a2da780d4 Signed-off-by: Surbhi Singh Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3250694 Reviewed-by: Sachin Nikam Reviewed-by: Ketan Patil GVS: buildbot_gerritrpt --- drivers/video/tegra/nvmap/nvmap_handle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 74b0fbd3..eaa42527 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -319,6 +319,7 @@ static void remove_handle_ref(struct nvmap_client *client, { nvmap_ref_lock(client); atomic_dec(&ref->handle->share_count); + BUG_ON(client->handle_count == 0); client->handle_count--; rb_erase(&ref->node, &client->handle_refs); nvmap_ref_unlock(client);