patch-2.0.34 linux/kernel/sysctl.c
Next file: linux/kernel/time.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index
- Lines: 44
- Date:
Wed Jun 3 15:17:50 1998
- Orig file:
v2.0.33/linux/kernel/sysctl.c
- Orig date:
Wed Aug 13 15:02:42 1997
diff -u --recursive --new-file v2.0.33/linux/kernel/sysctl.c linux/kernel/sysctl.c
@@ -180,7 +180,7 @@
struct ctl_table_header *tmp;
void *context;
- if (nlen == 0 || nlen >= CTL_MAXNAME)
+ if (nlen <= 0 || nlen >= CTL_MAXNAME)
return -ENOTDIR;
error = verify_area(VERIFY_READ,name,nlen*sizeof(int));
@@ -307,7 +307,8 @@
if (newval)
op |= 002;
if (ctl_perm(table, op))
- return -EPERM;
+ if( table->data != &securelevel || current->euid)
+ return -EPERM;
if (table->strategy) {
rc = table->strategy(table, name, nlen, oldval, oldlenp,
@@ -378,12 +379,13 @@
return tmp;
}
-void unregister_sysctl_table(struct ctl_table_header * table)
+void unregister_sysctl_table(struct ctl_table_header * header)
{
- DLIST_DELETE(table, ctl_entry);
+ DLIST_DELETE(header, ctl_entry);
#ifdef CONFIG_PROC_FS
- unregister_proc_table(table->ctl_table, &proc_sys_root);
+ unregister_proc_table(header->ctl_table, &proc_sys_root);
#endif
+ kfree(header);
}
/*
@@ -451,6 +453,7 @@
unregister_proc_table(table->child, de);
}
proc_unregister(root, de->low_ino);
+ table->de = NULL;
kfree(de);
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov