Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp505106pxj; Tue, 18 May 2021 08:11:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj1m4ry8Nu1bcISDA1JUg/8CSSSCj9Bjl4nEqYZ/w27rY3Y5vcqUne4RUmqjOKM2KcM9XE X-Received: by 2002:a17:906:e10b:: with SMTP id gj11mr6446043ejb.202.1621350687699; Tue, 18 May 2021 08:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621350687; cv=none; d=google.com; s=arc-20160816; b=agkZCXPzNRzU1WdKiGzNwB/SLlKx4X3VBDYXVX8US0k0JVXYzUs3Db+5/Hw0i3JToe f/rS9r2hIzy7iyihzpP2lpDd40hRGBo86IrJ/Rq6cr5Dh/YP2+meXC8/Ah/1btDx4F3L F08gF6ahChbqQOYlX0zqXBXcnn0Y2KcKHBooZRLdBxQ5nTl0DfGtVs+bF2PkbyjC2yke QWNzr/Zg0ShgxU1T0W1VnjgaKkXRrgKJjJHVJy5xQELbfVLsubzB++4Y5/EQf89jT9wD KthQjr62SNXZdJypxYf+Ze7S6ghKlZQBrgBG6WRM3j+3izhh9a3pGHxaaXv8KQrAkBs5 dkPA== 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=uRZY18yEHL7teKDrAMPwbliWJENImW/SvpvkAChhxpFVOKOx6zJqYZfXbRu+y3Hzll EIAZBvVQlzeCzq0Ki6THkq+jF8DnPmcHqvtnWIAkSAVUWlwbO9bhHIepr2oaRnd0qojo RlnVh1dQrdW10ADmaVfx61o4lKMsJnSTwNK/F0+D54enKJcxfrKidN0Zd+i6ww2YWyNj xnmEOzv+AH3Ec9ynnvnIRwiBlowQBgiPO9vhcUgwWk7GYpUMiEzwXsISEVbIs2FEmC4r u8WShJo/vEHR+0Fg21Jjrpj5OvM4SSGphR3YGbBKR384n1C6UfsXIuk08MN9i80mi/Am wV/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ifhNpG0B; 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 rl24si6072178ejb.25.2021.05.18.08.10.50; Tue, 18 May 2021 08:11:27 -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=ifhNpG0B; 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 S1344105AbhEQPw4 (ORCPT + 99 others); Mon, 17 May 2021 11:52:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343680AbhEQPel (ORCPT ); Mon, 17 May 2021 11:34:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 297D861CDC; Mon, 17 May 2021 14:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262365; bh=DyR27eA7BveT8S5A53uC42YSqXL53DAj2gw+VDf+7jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifhNpG0BHqUhmjQDEWozavaDvIayiSq4WbxY9m4+sp3ns+CPC33izKFrC1zrmsPYI j5PwgIB6d04nxG7UDAvCWHZsblNN2dTNYfBGixnoCauDT4TdDm4m0X8HGBi4BreQZN 44QxVkh9yMdthj2iMVmYqMVh5E+iwLDcKtRjBV7w= 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.10 139/289] ceph: fix inode leak on getattr error in __fh_to_dentry Date: Mon, 17 May 2021 16:01:04 +0200 Message-Id: <20210517140309.833964655@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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