Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3289184imm; Sun, 29 Jul 2018 15:08:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpec85jvYbBazhtpTb8mEVvhPlKA8Lq50bgXFZyZf7S9bYjF4Kti94DrOIwII+7jNdb3x5gs X-Received: by 2002:a62:11c4:: with SMTP id 65-v6mr15367938pfr.54.1532902108131; Sun, 29 Jul 2018 15:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532902108; cv=none; d=google.com; s=arc-20160816; b=Q+hjoposeI1rW3P/M3wQNN7NnridGjxbqjmStfVepKkT1E43KYaV2IBbyJMDAZ1ogQ 46sleYy1WxmD2VK76cYT8YNuIBESND7aUr48IZZa1sAp2zo+uVS5AbTDYK4udX9VsnZs DUxcD8uAd4M045+i+VEx0Uyd+uRF163ZE/mX9FPKNFeeTvZ/o2cTShA+ZxpMcwycJy/n u8x8gfX+7p8JKGajrrDLAQElVDvfiihCypNSrSWctAN/lpUlilqULdrzawkYFvx3IrKr zLdt9IqP/eOnhOMUV2cVCVWn0xmQO/G8a/h26rZAcG7DDmeOjhOePGr80WQ6WwVnzLLQ RNwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Wk0q5v3RJZZFaO/9lrp5ubJh/t7Y+X8CjK+aY4I0aQI=; b=ZKAA7IQ6w6yxlDvrCusj9votdgO/yTDJeDHJ07ZcodhcGqyLW1vZ4JKiTi+X2niJU/ axYNFAYRUjQJkJeGYjHf8gLTdp1J5IJy/f4o2JWn4y5as1fkpGbPP0FKTxJSqcuOLiCs xSlH50xNRckFfwucUZYP4NGE8mFccTp6zxnv/nPEn77+N6yzFrPniaAiAo7guXhT6r8y lI1uHE2ThMG88EFf0qchFGL9AMMJ4+NkunjJSmd8uicEOM0mmDARJKbdZXvJ9VxsAn2p xocneXNOo03wHdh3VqLjYbpj2lsIENCA92kvgpDkvO7I3bMoP9kx2bGrE4bF4y5R59Zr 6VdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si8578164plo.434.2018.07.29.15.08.14; Sun, 29 Jul 2018 15:08:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731803AbeG2Xid (ORCPT + 99 others); Sun, 29 Jul 2018 19:38:33 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51588 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728976AbeG2Xg4 (ORCPT ); Sun, 29 Jul 2018 19:36:56 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fjto6-0003Vb-Hl; Sun, 29 Jul 2018 22:04:54 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [PATCH 07/16] ext2: make sure that partially set up inodes won't be returned by ext2_iget() Date: Sun, 29 Jul 2018 23:04:44 +0100 Message-Id: <20180729220453.13431-7-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180729220453.13431-1-viro@ZenIV.linux.org.uk> References: <20180729220317.GB30522@ZenIV.linux.org.uk> <20180729220453.13431-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/ext2/ialloc.c | 3 +-- fs/ext2/namei.c | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 6484199b35d1..5c3d7b7e4975 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -611,8 +611,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode, dquot_drop(inode); inode->i_flags |= S_NOQUOTA; clear_nlink(inode); - unlock_new_inode(inode); - iput(inode); + discard_new_inode(inode); return ERR_PTR(err); fail: diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 152453a91877..0c26dcc5d850 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -45,8 +45,7 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) return 0; } inode_dec_link_count(inode); - unlock_new_inode(inode); - iput(inode); + discard_new_inode(inode); return err; } @@ -192,8 +191,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry, out_fail: inode_dec_link_count(inode); - unlock_new_inode(inode); - iput (inode); + discard_new_inode(inode); goto out; } @@ -261,8 +259,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) out_fail: inode_dec_link_count(inode); inode_dec_link_count(inode); - unlock_new_inode(inode); - iput(inode); + discard_new_inode(inode); out_dir: inode_dec_link_count(dir); goto out; -- 2.11.0