Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3064378pxj; Mon, 17 May 2021 16:51:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5zOeQ/EwXNoHtM3YVi0NkVqeyb6BJVG0YXCZf56DZJLWVk/yYJTygstgHlp+ndmR7RskJ X-Received: by 2002:a50:9f6b:: with SMTP id b98mr3302900edf.318.1621295516537; Mon, 17 May 2021 16:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295516; cv=none; d=google.com; s=arc-20160816; b=P0mP0czy6bqKhob6g9FJ09BMlanF0kFJVOB857P4RHj01BN6hHXmRtKYQMeDYV3qxO ab5VVcF+WmWP+Ex7JMbOdoN7z1buPCRP0DZ3fG1yGMzXO5NyOR91spawpOBtsscbyUC9 01Ca60bPRS3eN4Zyl3cX9/aNuMINL7XBlnY/fxQ+Ktgagt0jh2TrQ2Qh1BDpDxa71aT7 dhTxxmm91A8HvTnmcWV7IiV+GvF+Lfcm7ixkxx/H2rVr+J237XGAPJUdXY3L5P2pV6Ta sv16LUJnZ0+Th/i2eYWl8SSlrjot+7IPgbvaiThHP90K2K1jEM7yUfxKI7x7m7vv7VR5 RcpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2CIjd2Z9pCzIOFvS0OVgqcJwcmTY0Jz4nIe0nKgyF0A=; b=AZXkSQfkdLAhTqIJ+TIr30jvIVGbc9la0NhMyJdMbByE3C4WpPfjIXE9F4aiY8WNDa PvqBE/EdiB9mxdxKQH0RbG4+85ThL9msiCpA5syA6IpTJlF1lV9nxgUkFMpYFIv7y6hY 7lVExLl1G9iR/+tUl5MdMQQXD2wv4JswmDSHLr6B/4P67r5dqpTn9E3ce7sCm6qnYNR+ 0M7JMgvUnhfS+WvHnb72ggOgrk1LRdhi3n63yyZG3LmPi3T2DKQn1UICbE3BsY6DRJwr H67SD4sYtZVHfPGSrElUTHmd13fP4sDoU39ZmRHXz/GACRS78QC8gZzf/73aqF1Irtmb +OFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DOVaItgp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb3si10649794ejc.236.2021.05.17.16.51.10; Mon, 17 May 2021 16:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DOVaItgp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239345AbhEQOXl (ORCPT + 99 others); Mon, 17 May 2021 10:23:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239493AbhEQOUY (ORCPT ); Mon, 17 May 2021 10:20:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59C1E6143B; Mon, 17 May 2021 14:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260666; bh=DyR27eA7BveT8S5A53uC42YSqXL53DAj2gw+VDf+7jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOVaItgpON1GssZsZM/vAtGNqh+cECii1nLLz9MEVGYTOHnwA+MssowAxIJB+ggG8 d3AR0uH7eNFMkyGApukfLyGmpRjVD/QYAtL4xAqLTsd1bXEXDbaayZFt5ASKK2hZWc /UP/NHh60bDrQmzgaMcRuH/7gSSPoaPcs+kJPnbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Xiubo Li , Ilya Dryomov , Sasha Levin Subject: [PATCH 5.12 186/363] ceph: fix inode leak on getattr error in __fh_to_dentry Date: Mon, 17 May 2021 16:00:52 +0200 Message-Id: <20210517140308.873306841@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Layton [ Upstream commit 1775c7ddacfcea29051c67409087578f8f4d751b ] Fixes: 878dabb64117 ("ceph: don't return -ESTALE if there's still an open file") Signed-off-by: Jeff Layton Reviewed-by: Xiubo Li Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- fs/ceph/export.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ceph/export.c b/fs/ceph/export.c index e088843a7734..baa6368bece5 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -178,8 +178,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) return ERR_CAST(inode); /* We need LINK caps to reliably check i_nlink */ err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); - if (err) + if (err) { + iput(inode); return ERR_PTR(err); + } /* -ESTALE if inode as been unlinked and no file is open */ if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) { iput(inode); -- 2.30.2