Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2957361imu; Mon, 19 Nov 2018 08:36:43 -0800 (PST) X-Google-Smtp-Source: AJdET5c3X6mLgtbGv1lVfNFWwHxl69AzyDAuBhIXWZTzziQkszuCbpdob+bDeoZvy8cpvoB3MMBe X-Received: by 2002:a17:902:9009:: with SMTP id a9-v6mr23256774plp.134.1542645403070; Mon, 19 Nov 2018 08:36:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645403; cv=none; d=google.com; s=arc-20160816; b=aqe4CW9pmTC1Ej+isVsWIL5kIMuUtufqYLFZ04OAiCIp9v+m5nhU7r+bJ6vyfmTwo/ C9LEiyz+Jum7YsSya4s0H12QLuRGx2POUt8ufmGEKmPubOBoT9NWmQRyZCP5l0gSFztu CTJbS36YritS8qftgjCQR2WPPzr+PBPz169T/phYHBPpF3fuMPT2xxuhk/ELumqOaeUp z4TzWJHAhEAVN8z2vIifOv5etu9LchmpQ30Dhj1nz1TW7ATKk3Qo86zujXXskfpXmzhf URdN6NCrjPklSr5Yd6uZW/i7odnJKX5t5aVpRpk9p38F+QgMhzltUBWPhwTyB/o4MVqR GQzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cGdI4pE1VhWH65yyLLNZDGsFt0Vyjgtj+7HJLJPhfKQ=; b=ll1+VY4cZ9i6kriHkE+tAEj11/NlYqIWj03dFRI/cev4L2wCasdySqDOym9tAGXOTj yzfYKfq9zo3RjwuDNiYtiG5FL39WG8mt8/KXv7sDT30aKfQS0yJ5ZfUC29v7eWyqagHT VvLr9UDp3eiEw5Rj6Ey+Ou95pYC8vhEUOb/2C2rTATIvHbsSxRnQ2nqebilmhNrvADfM wdJjQOo8SxQoIcLJNUZlMjhoU+N3rUCKYFdSi/VslxhUNRBtCkFV/jErwwk5gvfV4wQL LTDNHv+9ImnD9ZRt9CQS7cYeZHEvz7pAHxtPKdHag+S5cmdNVh0RepnB6sSqte7oCvDp wBrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="c/8OC1Nd"; 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 r22-v6si53105248pfr.18.2018.11.19.08.36.28; Mon, 19 Nov 2018 08:36:43 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="c/8OC1Nd"; 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 S1731222AbeKTC6A (ORCPT + 99 others); Mon, 19 Nov 2018 21:58:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:56872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730122AbeKTC57 (ORCPT ); Mon, 19 Nov 2018 21:57:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 537352086A; Mon, 19 Nov 2018 16:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645231; bh=YFNXikzqD/rmKLDlYTIAt8DFP6cckuzT6Db6qHwZbeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/8OC1NdGY5Jft5WwU+h2h0mokYBtUJm4/d3b6243LDvBsuUMZda1zo8Z0Oq6ckxB Ec8nQ2CdUwuuc+Q5G3uXhRVGJC7G71BPMKG1DW6EBwot2ldpoF03SdOrxEI8UkrctE I5tQK0gTiAjZwpSPJcJqaFiIYVA/viLWuSlSfVqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Yan, Zheng" , Ilya Dryomov Subject: [PATCH 4.19 086/205] Revert "ceph: fix dentry leak in splice_dentry()" Date: Mon, 19 Nov 2018 17:26:33 +0100 Message-Id: <20181119162631.564218605@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yan, Zheng commit efe328230dc01aa0b1269aad0b5fae73eea4677a upstream. This reverts commit 8b8f53af1ed9df88a4c0fbfdf3db58f62060edf3. splice_dentry() is used by three places. For two places, req->r_dentry is passed to splice_dentry(). In the case of error, req->r_dentry does not get updated. So splice_dentry() should not drop reference. Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: "Yan, Zheng" Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1132,8 +1132,12 @@ static struct dentry *splice_dentry(stru if (IS_ERR(realdn)) { pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", PTR_ERR(realdn), dn, in, ceph_vinop(in)); - dput(dn); - dn = realdn; /* note realdn contains the error */ + dn = realdn; + /* + * Caller should release 'dn' in the case of error. + * If 'req->r_dentry' is passed to this function, + * caller should leave 'req->r_dentry' untouched. + */ goto out; } else if (realdn) { dout("dn %p (%d) spliced with %p (%d) "