Commit c4185a0e authored by Denis V. Lunev's avatar Denis V. Lunev Committed by Linus Torvalds

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=10737Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Cc: David Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Acked-by: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarRobert Olsson <robert.olsson@its.uu.se>
Acked-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Reported-by: default avatarRoland Kletzing <devzero@web.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 53978d0a
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment