From: Jan Kara Date: Thu, 4 Sep 2014 14:19:47 +0000 (+0200) Subject: udf: Properly detect stale inodes X-Git-Tag: v3.17-rc5~32^2~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4071b913622316970d0e1919f7d82b4403fec5f2;p=karo-tx-linux.git 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: Jan Kara --- diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 788fc58ea78e..3a44d9187aad 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1435,8 +1435,10 @@ reread: 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);