All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] proc: proc_get_inode should get module only once
@ 2008-05-20  9:59 Denis V. Lunev
  2008-05-20  9:59 ` [PATCH 2/4] pktgen: make sure that pktgen_thread_worker has been executed Denis V. Lunev
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Denis V. Lunev @ 2008-05-20  9:59 UTC (permalink / raw)
  To: akpm; +Cc: netdev, linux-kernel, Denis V. Lunev, David Miller,
	Patrick McHardy

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.

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>
---
 fs/proc/inode.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 6f4e8dc..b08d100 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:
-- 
1.5.3.rc5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-05-23  1:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20  9:59 [PATCH 1/4] proc: proc_get_inode should get module only once Denis V. Lunev
2008-05-20  9:59 ` [PATCH 2/4] pktgen: make sure that pktgen_thread_worker has been executed Denis V. Lunev
2008-05-20 18:30   ` Robert Olsson
2008-05-20 18:43     ` Denis V. Lunev
2008-05-20 19:59       ` Robert Olsson
2008-05-20 22:12   ` David Miller
2008-05-20  9:59 ` [PATCH 3/4] modules: proper cleanup of kobject without CONFIG_SYSFS Denis V. Lunev
2008-05-22  9:20   ` Rusty Russell
2008-05-22 11:44     ` Denis V. Lunev
2008-05-23  1:51       ` Rusty Russell
2008-05-22 17:54     ` Greg KH
2008-05-23  1:34       ` Rusty Russell
2008-05-20  9:59 ` [PATCH 4/4] flock: remove unused fields from file_lock_operations Denis V. Lunev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.