mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: fix resource leak in error path
In nvgpu_request_firmware(), if fw->data is NULL, we jump to label "err" and leak the storage pointed by linux_fw Fix this by releasing firmware in error path if fw->data is NULL Coverity id : 2513066 Bug 200291879 Change-Id: Ieb5e22137cebb4cd02415b805941969b95a38668 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1479884 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
677edcd6ec
commit
d0955cad82
@@ -93,7 +93,7 @@ struct nvgpu_firmware *nvgpu_request_firmware(struct gk20a *g,
|
||||
|
||||
fw->data = nvgpu_kmalloc(g, linux_fw->size);
|
||||
if (!fw->data)
|
||||
goto err;
|
||||
goto err_release;
|
||||
|
||||
memcpy(fw->data, linux_fw->data, linux_fw->size);
|
||||
fw->size = linux_fw->size;
|
||||
@@ -102,6 +102,8 @@ struct nvgpu_firmware *nvgpu_request_firmware(struct gk20a *g,
|
||||
|
||||
return fw;
|
||||
|
||||
err_release:
|
||||
release_firmware(linux_fw);
|
||||
err:
|
||||
nvgpu_kfree(g, fw);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user