Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c055e99e authored by Al Viro's avatar Al Viro Committed by root
Browse files

btrfs: check link counter overflow in link(2)

parent 92986796
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -4837,6 +4837,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
	if (root->objectid != BTRFS_I(inode)->root->objectid)
	if (root->objectid != BTRFS_I(inode)->root->objectid)
		return -EXDEV;
		return -EXDEV;


	if (inode->i_nlink == ~0U)
		return -EMLINK;

	btrfs_inc_nlink(inode);
	btrfs_inc_nlink(inode);
	inode->i_ctime = CURRENT_TIME;
	inode->i_ctime = CURRENT_TIME;