Skip to content

Commit

Permalink
ext4: Limit number of links that can be created by ext4_link()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Theodore Ts'o committed Aug 30, 2009
1 parent 2c94eb8 commit b05ab1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,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;

/*
Expand Down

0 comments on commit b05ab1d

Please sign in to comment.