[lkml]   [2012]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectPATCH [1/1] fs/proc: unregister_sysctl_table hanging forever
unregister_sysctl_table hangs forever if all references to its
ctl_table_header structure are not dropped.
This happens sometimes because of a leak in proc_sys_lookup().
proc_sys_lookup() gets a reference to the table via lookup_entry(), but it
does not release it when a subsequent call to sysctl_follow_link() fails.
This patch fixes this leak by making sure the reference is always dropped
on return.
See also 076c3eed2c31773200b082568957fd8852ae93d7 which reorganized this
code in 3.4.

Tested in Linux 3.4.4.

Signed-off-by: Francesco Ruggeri <>

Index: linux-3.4.x86_64/fs/proc/proc_sysctl.c
--- linux-3.4.x86_64.orig/fs/proc/proc_sysctl.c
+++ linux-3.4.x86_64/fs/proc/proc_sysctl.c
@@ -462,9 +462,6 @@ static struct dentry *proc_sys_lookup(st

inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
- if (h)
- sysctl_head_finish(h);
if (!inode)
goto out;

@@ -473,6 +470,8 @@ static struct dentry *proc_sys_lookup(st
d_add(dentry, inode);

+ if (h)
+ sysctl_head_finish(h);
return err;

 \ /
  Last update: 2012-09-12 22:01    [W:0.026 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site