diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2011-03-04 12:15:18 -0500 |
---|---|---|
committer | root <Chris Mason chris.mason@oracle.com> | 2011-03-28 05:37:56 -0400 |
commit | c055e99eea6e4f614267632fac546e7896c0227b (patch) | |
tree | df65ff7c1a3b0c4301edffbadd9f23f9023e5159 | |
parent | 92986796d84ef939e304099dece32572a755b280 (diff) |
btrfs: check link counter overflow in link(2)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/inode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4822b3132784..04babaf31a33 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4837,6 +4837,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4837 | if (root->objectid != BTRFS_I(inode)->root->objectid) | 4837 | if (root->objectid != BTRFS_I(inode)->root->objectid) |
4838 | return -EXDEV; | 4838 | return -EXDEV; |
4839 | 4839 | ||
4840 | if (inode->i_nlink == ~0U) | ||
4841 | return -EMLINK; | ||
4842 | |||
4840 | btrfs_inc_nlink(inode); | 4843 | btrfs_inc_nlink(inode); |
4841 | inode->i_ctime = CURRENT_TIME; | 4844 | inode->i_ctime = CURRENT_TIME; |
4842 | 4845 | ||