patch-2.4.12 linux/fs/namei.c

Next file: linux/fs/namespace.c
Previous file: linux/fs/ext2/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.11/linux/fs/namei.c linux/fs/namei.c
@@ -325,9 +325,7 @@
 }
 
 /*
- * Yes, this really increments the link_count by 5, and
- * decrements it by 4. Together with checking against 40,
- * this limits recursive symlink follows to 8, while
+ * This limits recursive symlink follows to 8, while
  * limiting consecutive symlinks to 40.
  *
  * Without that kind of total limit, nasty chains of consecutive
@@ -336,16 +334,19 @@
 static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	int err;
-	if (current->link_count >= 40)
+	if (current->link_count >= 5)
+		goto loop;
+	if (current->total_link_count >= 40)
 		goto loop;
 	if (current->need_resched) {
 		current->state = TASK_RUNNING;
 		schedule();
 	}
-	current->link_count += 5;
+	current->link_count++;
+	current->total_link_count++;
 	UPDATE_ATIME(dentry->d_inode);
 	err = dentry->d_inode->i_op->follow_link(dentry, nd);
-	current->link_count -= 4;
+	current->link_count--;
 	return err;
 loop:
 	path_release(nd);
@@ -636,7 +637,7 @@
 
 int path_walk(const char * name, struct nameidata *nd)
 {
-	current->link_count = 0;
+	current->total_link_count = 0;
 	return link_path_walk(name, nd);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)