Skip to content

Commit

Permalink
udf: Properly detect stale inodes
Browse files Browse the repository at this point in the history
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: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Sep 4, 2014
1 parent 6d3d5e8 commit 4071b91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,10 @@ static int udf_read_inode(struct inode *inode)
read_unlock(&sbi->s_cred_lock);

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

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

0 comments on commit 4071b91

Please sign in to comment.