proc: always do ->release
authorAlexey Dobriyan <adobriyan@gmail.com>
Fri, 25 Jul 2008 08:48:29 +0000 (01:48 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Jul 2008 17:53:44 +0000 (10:53 -0700)
commit881adb85358309ea9c6f707394002719982ec607
treee4ffc2f6ca6013bab97bdb77b80e98b46a8d01e1
parent6e644c3126149b65460610fe5a00d8a162092abe
proc: always do ->release

Current two-stage scheme of removing PDE emphasizes one bug in proc:

open
rmmod
remove_proc_entry
close

->release won't be called because ->proc_fops were cleared.  In simple
cases it's small memory leak.

For every ->open, ->release has to be done.  List of openers is introduced
which is traversed at remove_proc_entry() if neeeded.

Discussions with Al long ago (sigh).

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c
fs/proc/inode.c
fs/proc/internal.h
include/linux/proc_fs.h