Thread (65 messages) flat view 65 messages, 3 authors, 2012-01-30
STALE5336d

[PATCH 14/29] sysctl: A more obvious version of grab_header.

From: Eric W. Biederman <hidden>
Date: 2012-01-27 04:49:55
Also in: linux-fsdevel, lkml
Subsystem: filesystems (vfs and infrastructure), proc filesystem, proc sysctl, the rest · Maintainers: Alexander Viro, Christian Brauner, Kees Cook, Joel Granados, Linus Torvalds

Instead of relying on sysct_head_next(NULL) to magically
return the right header for the root directory instead
explicitly transform NULL into the root directories header.

Signed-off-by: Eric W. Biederman <redacted>
---
 fs/proc/proc_sysctl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index e573f9b..1544485 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -267,10 +267,10 @@ static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
 
 static struct ctl_table_header *grab_header(struct inode *inode)
 {
-	if (PROC_I(inode)->sysctl)
-		return sysctl_head_grab(PROC_I(inode)->sysctl);
-	else
-		return sysctl_head_next(NULL);
+	struct ctl_table_header *head = PROC_I(inode)->sysctl;
+	if (!head)
+		head = &root_table_header;
+	return sysctl_head_grab(head);
 }
 
 static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
-- 
1.7.2.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help