LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] drivers: rtc: Add module_put on error path in rtc_proc_open
@ 2011-01-28 13:10 Alexander Strakh
0 siblings, 0 replies; only message in thread
From: Alexander Strakh @ 2011-01-28 13:10 UTC (permalink / raw)
To: a.zummo; +Cc: rtc-linux, linux-kernel, Alexander Strakh, Alexander Strakh
From: Alexander Strakh <cromlehg@gmail.com>
In file drivers/rtc/rtc-proc.c in linux-2.6.37:
The seq_open function can return -ENOMEM.
86 if (!try_module_get(THIS_MODULE))
87 return -ENODEV;
88
89 return single_open(file, rtc_proc_show, rtc);
In this case before exiting (line 89) from rtc_proc_open
the module_put(THIS_MODULE) must be called.
Found by Linux Device Drivers Verification Project
Signed-off-by: Alexander Strakh <strakh@ispras.ru>
---
drivers/rtc/rtc-proc.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index c086fc3..242bbf8 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -81,12 +81,16 @@ static int rtc_proc_show(struct seq_file *seq, void *offset)
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;
}
static int rtc_proc_release(struct inode *inode, struct file *file)
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-28 12:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 13:10 [PATCH 1/1] drivers: rtc: Add module_put on error path in rtc_proc_open Alexander Strakh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).