patch-2.1.43 linux/fs/proc/root.c

Next file: linux/fs/proc/scsi.c
Previous file: linux/fs/proc/procfs_syms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.42/linux/fs/proc/root.c linux/fs/proc/root.c
@@ -64,7 +64,6 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	NULL,			/* readlink */
-	NULL,			/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -105,7 +104,6 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	NULL,			/* readlink */
-	NULL,			/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -266,7 +264,6 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	NULL,			/* readlink */
-	NULL,			/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -348,17 +345,6 @@
 /*
  * /proc/self:
  */
-static int proc_self_followlink(struct inode * dir, struct inode * inode,
-			int flag, int mode, struct inode ** res_inode)
-{
-	iput(dir);
-	*res_inode = proc_get_inode(inode->i_sb, (current->pid << 16) + PROC_PID_INO, &proc_pid);
-	iput(inode);
-	if (!*res_inode)
-		return -ENOENT;
-	return 0;
-}
-
 static int proc_self_readlink(struct inode * inode, char * buffer, int buflen)
 {
 	int len;
@@ -384,7 +370,6 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	proc_self_readlink,	/* readlink */
-	proc_self_followlink,	/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -436,6 +421,13 @@
 	S_IFREG | S_IRUGO, 1, 0, 0,
 	0, &proc_array_inode_operations
 };
+#if defined (CONFIG_AMIGA) || defined (CONFIG_ATARI)
+static struct proc_dir_entry proc_root_hardware = {
+	PROC_HARDWARE, 8, "hardware",
+	S_IFREG | S_IRUGO, 1, 0, 0,
+	0, &proc_array_inode_operations
+};
+#endif
 static struct proc_dir_entry proc_root_self = {
 	PROC_SELF, 4, "self",
 	S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, 1, 0, 0,
@@ -539,6 +531,13 @@
 	S_IFREG | S_IRUGO, 1, 0, 0,
 	0, &proc_array_inode_operations
 };
+#ifdef CONFIG_OMIRR
+static struct proc_dir_entry proc_root_omirr = {
+	PROC_OMIRR, 5, "omirr",
+	S_IFREG | S_IRUSR, 1, 0, 0,
+	0, &proc_omirr_inode_operations
+};
+#endif
 
 void proc_root_init(void)
 {
@@ -599,7 +598,9 @@
 #endif
 	proc_register(&proc_root, &proc_openprom);
 #endif
-		   
+#if defined (CONFIG_AMIGA) || defined (CONFIG_ATARI)
+	proc_register(&proc_root, &proc_root_hardware);
+#endif
 	proc_register(&proc_root, &proc_root_slab);
 
 	if (prof_shift) {
@@ -641,6 +642,16 @@
 		return -EINVAL;
 	}
 
+	/* Either remove this as soon as possible due to security problems,
+	 * or uncomment the root-only usage.
+	 */
+
+	/* Allow generic inode lookups everywhere.
+	 * No other name in /proc must begin with a '['.
+	 */
+	if(/*!current->uid &&*/ name[0] == '[')
+		return proc_arbitrary_lookup(dir,name,len,result);
+
 	/* Special case "." and "..": they aren't on the directory list */
 	*result = dir;
 	if (!len)
@@ -686,7 +697,7 @@
 	int ino, retval;
 	struct task_struct *p;
 
-	dir->i_count++;
+	atomic_inc(&dir->i_count);
 
 	if (dir->i_ino == PROC_ROOT_INO) { /* check for safety... */
 		dir->i_nlink = proc_root.nlink;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov