Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295465
b: refs/heads/master
c: e54012c
h: refs/heads/master
i:
  295463: 0829704
v: v3
  • Loading branch information
Eric W. Biederman committed Jan 25, 2012
1 parent e7e04c6 commit b22a481
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 60a47a2e823cbe6b609346bffff61a00c0c76470
refs/heads/master: e54012cede6749528899f66a72312522a179d427
20 changes: 11 additions & 9 deletions trunk/fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static int sysctl_follow_link(struct ctl_table_header **phead,
struct ctl_table **pentry, struct nsproxy *namespaces);
static int insert_links(struct ctl_table_header *head);
static void put_links(struct ctl_table_header *header);
static int sysctl_check_dups(struct ctl_dir *dir, struct ctl_table *table);

static void sysctl_print_dir(struct ctl_dir *dir)
{
Expand Down Expand Up @@ -123,6 +124,10 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header)
{
int err;

err = sysctl_check_dups(dir, header->ctl_table);
if (err)
return err;

dir->header.nreg++;
header->parent = dir;
err = insert_links(header);
Expand Down Expand Up @@ -891,7 +896,7 @@ static int sysctl_follow_link(struct ctl_table_header **phead,
return ret;
}

static int sysctl_check_table_dups(const char *path, struct ctl_table *old,
static int sysctl_check_table_dups(struct ctl_dir *dir, struct ctl_table *old,
struct ctl_table *table)
{
struct ctl_table *entry, *test;
Expand All @@ -900,17 +905,17 @@ static int sysctl_check_table_dups(const char *path, struct ctl_table *old,
for (entry = old; entry->procname; entry++) {
for (test = table; test->procname; test++) {
if (strcmp(entry->procname, test->procname) == 0) {
printk(KERN_ERR "sysctl duplicate entry: %s/%s\n",
path, test->procname);
printk(KERN_ERR "sysctl duplicate entry: ");
sysctl_print_dir(dir);
printk(KERN_CONT "/%s\n", test->procname);
error = -EEXIST;
}
}
}
return error;
}

static int sysctl_check_dups(struct ctl_dir *dir,
const char *path, struct ctl_table *table)
static int sysctl_check_dups(struct ctl_dir *dir, struct ctl_table *table)
{
struct ctl_table_set *set;
struct ctl_table_header *head;
Expand All @@ -922,7 +927,7 @@ static int sysctl_check_dups(struct ctl_dir *dir,
continue;
if (head->parent != dir)
continue;
error = sysctl_check_table_dups(path, head->ctl_table, table);
error = sysctl_check_table_dups(dir, head->ctl_table, table);
}
return error;
}
Expand Down Expand Up @@ -1166,9 +1171,6 @@ struct ctl_table_header *__register_sysctl_table(
}

spin_lock(&sysctl_lock);
if (sysctl_check_dups(dir, path, table))
goto fail_put_dir_locked;

if (insert_header(dir, header))
goto fail_put_dir_locked;

Expand Down

0 comments on commit b22a481

Please sign in to comment.