summaryrefslogtreecommitdiff
path: root/drivers/base/firmware_loader/sysfs_upload.c
diff options
context:
space:
mode:
authorRuss Weight <russell.h.weight@intel.com>2022-08-31 03:25:18 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-01 18:47:27 +0300
commit789bba82f63c3e81dce426ba457fc7905b30ac6e (patch)
treeac7efbdb2aa65d3e69044fb646951ed63829f974 /drivers/base/firmware_loader/sysfs_upload.c
parent8b40c38e37492b5bdf8e95b46b5cca9517a9957a (diff)
downloadlinux-789bba82f63c3e81dce426ba457fc7905b30ac6e.tar.xz
firmware_loader: Fix memory leak in firmware upload
In the case of firmware-upload, an instance of struct fw_upload is allocated in firmware_upload_register(). This data needs to be freed in fw_dev_release(). Create a new fw_upload_free() function in sysfs_upload.c to handle the firmware-upload specific memory frees and incorporate the missing kfree call for the fw_upload structure. Fixes: 97730bbb242c ("firmware_loader: Add firmware-upload support") Cc: stable <stable@kernel.org> Signed-off-by: Russ Weight <russell.h.weight@intel.com> Link: https://lore.kernel.org/r/20220831002518.465274-1-russell.h.weight@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_loader/sysfs_upload.c')
-rw-r--r--drivers/base/firmware_loader/sysfs_upload.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index 63e15bddd80c..a0af8f5f13d8 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -264,6 +264,15 @@ int fw_upload_start(struct fw_sysfs *fw_sysfs)
return 0;
}
+void fw_upload_free(struct fw_sysfs *fw_sysfs)
+{
+ struct fw_upload_priv *fw_upload_priv = fw_sysfs->fw_upload_priv;
+
+ free_fw_priv(fw_sysfs->fw_priv);
+ kfree(fw_upload_priv->fw_upload);
+ kfree(fw_upload_priv);
+}
+
/**
* firmware_upload_register() - register for the firmware upload sysfs API
* @module: kernel module of this device