提交 113fab13 编写于 作者: M matthieu castet 提交者: Linus Torvalds

[PATCH] fix leaks in request_firmware_nowait

Wasn't checking return error and forgot to free in some case.
Signed-off-by: NMatthieu CASTET <castet.matthieu@free.fr>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 ff6ed406
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册