summaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-05-23 13:04:47 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-24 09:56:11 -0700
commitc4185a0e019387f5ad6e99009804965531fa1fab (patch)
treec7d4e534808d4052373f5f7d4b78adaf57d051b9 /fs/proc/inode.c
parent53978d0a7a27eb036b9bf33c4caa06257a9dbed7 (diff)
downloadlinux-c4185a0e019387f5ad6e99009804965531fa1fab.tar.gz
linux-c4185a0e019387f5ad6e99009804965531fa1fab.tar.bz2
linux-c4185a0e019387f5ad6e99009804965531fa1fab.zip
proc: proc_get_inode() should get module only once
Any file under /proc/net opened more than once leaked the refcounter on the module it belongs to. The problem is that module_get is called for each file opening while module_put is called only when /proc inode is destroyed. So, lets put module counter if we are dealing with already initialised inode. Addresses http://bugzilla.kernel.org/show_bug.cgi?id=10737 Signed-off-by: Denis V. Lunev <den@openvz.org> Cc: David Miller <davem@davemloft.net> Cc: Patrick McHardy <kaber@trash.net> Acked-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Robert Olsson <robert.olsson@its.uu.se> Acked-by: Eric W. Biederman <ebiederm@xmission.com> Reported-by: Roland Kletzing <devzero@web.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 6f4e8dc97da1..b08d10017911 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -425,7 +425,8 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
}
}
unlock_new_inode(inode);
- }
+ } else
+ module_put(de->owner);
return inode;
out_ino: