Подробности
[В начало]
Проблема в реализации № L0026
Краткое описание
drivers/rtc/rtc-proc.c: отсутствует module_put после module_get on error path
Подробное описание
В файле drivers/rtc/rtc-proc.c функция seq_open() может вернуть -ENOMEM.
86 if (!try_module_get(THIS_MODULE)) 87 return -ENODEV; 88 89 return single_open(file, rtc_proc_show, rtc);В этом случае перед выходом (строка 89) из rtc_proc_open необходимо вызвать module_put(THIS_MODULE)
Способы устранения
drivers/rtc/rtc-proc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff -puN drivers/rtc/rtc-proc.c~drivers-rtc-add-module_put-on-error-path-in-rtc_proc_open drivers/rtc/rtc-proc.c
--- a/drivers/rtc/rtc-proc.c~drivers-rtc-add-module_put-on-error-path-in-rtc_proc_open
+++ a/drivers/rtc/rtc-proc.c
@@ -81,12 +81,16 @@ static int rtc_proc_show(struct seq_file
static int rtc_proc_open(struct inode *inode, struct file *file)
{
+ int ret;
struct rtc_device *rtc = PDE(inode)->data;
if (!try_module_get(THIS_MODULE))
return -ENODEV;
- return single_open(file, rtc_proc_show, rtc);
+ ret = single_open(file, rtc_proc_show, rtc);
+ if (ret)
+ module_put(THIS_MODULE);
+ return ret;
}
Компонент
linux-kernel 2.6.37
Принято
https://lkml.org/lkml/2011/1/28/103
commit
Статус
Исправлено в ядре 2.6.38-rc5
[В начало]
»