ecryptfs_lookup_interpose() opens the lower file of a regular file to read the size from the header. If that fails it marks the inode bad and returns, but a new inode is still I_NEW and nobody ever unlocks or puts it. So it leaks together with its lower inode, a concurrent lookup through another hard link waits for it forever and umount complains about busy inodes. The lower open fails e.g. with ETXTBSY while the lower file is executed. A cached inode is marked bad for all its other users instead. Use iget_failed() for a new inode and iput() for a cached one. Fixes: 3b06b3ebf441 ("eCryptfs: Fix new inode race condition") Cc: stable@vger.kernel.org Reported-by: Farhad Alemi Closes: https://lore.kernel.org/r/CA+0ovCgYP920GT68hAJK6Trjyv1kGv2dZAuem4LEunycQ=POww@mail.gmail.com Acked-by: Tyler Hicks Signed-off-by: Christian Brauner (Amutable) --- fs/ecryptfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 48e520960d66..3a966348a578 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -362,7 +362,10 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, if (S_ISREG(inode->i_mode)) { rc = ecryptfs_i_size_read(dentry, inode); if (rc) { - make_bad_inode(inode); + if (inode_state_read_once(inode) & I_NEW) + iget_failed(inode); + else + iput(inode); return ERR_PTR(rc); } } -- 2.53.0