lkml.org 
[lkml]   [2008]   [Aug]   [30]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateSat, 30 Aug 2008 09:34:12 +0400
FromAlexey Dobriyan <>
Subject[PATCH] proc: fix return value of proc_reg_open() in "too late" case
If ->open() wasn't called, returning 0 is misleading and, theoretically,
oopsable:
1. remove_proc_entry clears ->proc_fops, drops lock,
2. ->open "succeeds",
3. ->release oopses, because it assumes ->open was called (single_release()).

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 fs/proc/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -350,7 +350,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
 	if (!pde->proc_fops) {
 		spin_unlock(&pde->pde_unload_lock);
 		kfree(pdeo);
-		return rv;
+		return -EINVAL;
 	}
 	pde->pde_users++;
 	open = pde->proc_fops->open;


\
 
 \ /
  Last update: 2008-08-30 07:35    [from the cache]
©2003-2008