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

Commit 4071b913 authored by Jan Kara's avatar Jan Kara
Browse files

udf: Properly detect stale inodes



NFS can easily ask for inodes that are already deleted. Currently UDF
happily returns such inodes which is a bug. Return -ESTALE if
udf_read_inode() is asked to read deleted inode.

Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 6d3d5e86
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1435,8 +1435,10 @@ static int udf_read_inode(struct inode *inode)
	read_unlock(&sbi->s_cred_lock);
	read_unlock(&sbi->s_cred_lock);


	link_count = le16_to_cpu(fe->fileLinkCount);
	link_count = le16_to_cpu(fe->fileLinkCount);
	if (!link_count)
	if (!link_count) {
		link_count = 1;
		ret = -ESTALE;
		goto out;
	}
	set_nlink(inode, link_count);
	set_nlink(inode, link_count);


	inode->i_size = le64_to_cpu(fe->informationLength);
	inode->i_size = le64_to_cpu(fe->informationLength);