public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Increase recursive symlink limit from 5 to 8
@ 2004-01-07 23:12 Petter Reinholdtsen
  2004-01-11  1:03 ` Petter Reinholdtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Petter Reinholdtsen @ 2004-01-07 23:12 UTC (permalink / raw)
  To: linux-kernel


The comment in do_follow_link() do not match the code.  The comment
explain that the limit for recursive symlinks are 8, but the code
limit it to 5.  This is the current comment:

  /*
   * This limits recursive symlink follows to 8, while
   * limiting consecutive symlinks to 40.
   *
   * Without that kind of total limit, nasty chains of consecutive
   * symlinks can cause almost arbitrarily long lookups.
   */

I discovered it when I ran into a problem with the following symlinks
producing the error message "Too many levels of symbolic links" when I
tried to run /usr/lib/sendmail in our current software configuration.

  /usr/lib/sendmail      -> /local/sbin/sendmail
  /local/sbin/sendmail   -> /store/store/diskless/.exim/ver-4.22/sbin/sendmail
  /store/store/diskless/.exim/ver-4.22/sbin/sendmail -> /local/sbin/exim
  /local/sbin/exim ->
    /store/store/diskless/.exim/ver-4.22/sbin/exim@386linuxlibc62

As you can see, this have to visit exactly 5 files to reach the real
file "/store/store/diskless/.exim/ver-4.22/sbin/exim@386linuxlibc62".

I discovered this when testing Debian for the first time using this
software configuration.  RedHat did not have any problems follwing the
links, which suggests to me that they already increased the limit.

The fix seem to be to bring the code in sync with the comment of the
function, and increase the limit from 5 to 8.

--- linux-2.4.24/fs/namei.c.orig     Wed Jan  7 23:46:03 2004
+++ linux-2.4.24/fs/namei.c  Wed Jan  7 23:46:34 2004
@@ -335,7 +335,7 @@
 static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
        int err;
-       if (current->link_count >= 5)
+       if (current->link_count >= 8)
                goto loop;
        if (current->total_link_count >= 40)
                goto loop;

(I'm not on this mailing list, and do not really know how to proceed
to increase the chances of this patch being accepted into the official
source.  Please CC me if you reply. :)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-01-16 15:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-07 23:12 [PATCH] Increase recursive symlink limit from 5 to 8 Petter Reinholdtsen
2004-01-11  1:03 ` Petter Reinholdtsen
2004-01-11  7:01   ` Steve Youngs
2004-01-11  9:37     ` Peter Osterlund
2004-01-11  9:49     ` Arjan van de Ven
2004-01-16  0:45       ` GOTO Masanori
2004-01-16  0:56         ` Måns Rullgård
2004-01-16  1:25         ` viro
2004-01-16 15:46           ` Andries Brouwer
2004-01-16  3:08         ` Steve Youngs
2004-01-11 12:10     ` Felipe Alfaro Solana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox