aboutsummaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authormatthieu castet <castet.matthieu@free.fr>2005-11-13 16:07:39 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-13 18:14:17 -0800
commit113fab1386f0093602d9f48b424b945cafd3db23 (patch)
tree3d9f0853c2ce8ff846b5156ac91307f4107f3e8d /drivers/base
parentff6ed4063da39e6a30ce904005e4ed17385e2739 (diff)
[PATCH] fix leaks in request_firmware_nowait
Wasn't checking return error and forgot to free in some case. Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 98f6c02d679..59dacb6552c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -526,18 +526,23 @@ request_firmware_work_func(void *arg)
{
struct firmware_work *fw_work = arg;
const struct firmware *fw;
+ int ret;
if (!arg) {
WARN_ON(1);
return 0;
}
daemonize("%s/%s", "firmware", fw_work->name);
- _request_firmware(&fw, fw_work->name, fw_work->device,
+ ret = _request_firmware(&fw, fw_work->name, fw_work->device,
fw_work->hotplug);
- fw_work->cont(fw, fw_work->context);
- release_firmware(fw);
+ if (ret < 0)
+ fw_work->cont(NULL, fw_work->context);
+ else {
+ fw_work->cont(fw, fw_work->context);
+ release_firmware(fw);
+ }
module_put(fw_work->module);
kfree(fw_work);
- return 0;
+ return ret;
}
/**
@@ -586,6 +591,8 @@ request_firmware_nowait(
if (ret < 0) {
fw_work->cont(NULL, fw_work->context);
+ module_put(fw_work->module);
+ kfree(fw_work);
return ret;
}
return 0;