]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext4: Limit number of links that can be created by ext4_link()
authorTheodore Ts'o <tytso@mit.edu>
Sun, 30 Aug 2009 01:08:08 +0000 (21:08 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:06:18 +0000 (08:06 -0800)
(cherry picked from commit b05ab1dc3795e6f997fb0d34f38fce5012533c3e)

In ext4_link we need to check using EXT4_LINK_MAX, and not
EXT4_DIR_LINK_MAX(), since ext4_link() is creating hard links of
regular files, and not directories.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/namei.c

index 9d51ab9dd9da80af7ac7c165685aca9d403a9f84..06ce2d8859885c72bd7ecbadb84de11cc3750d26 100644 (file)
@@ -2310,7 +2310,7 @@ static int ext4_link(struct dentry *old_dentry,
        struct inode *inode = old_dentry->d_inode;
        int err, retries = 0;
 
-       if (EXT4_DIR_LINK_MAX(inode))
+       if (inode->i_nlink >= EXT4_LINK_MAX)
                return -EMLINK;
 
        /*