From patchwork Mon Dec 9 14:38:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 3311211 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C2B99F1F0 for ; Mon, 9 Dec 2013 14:38:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EE73202EA for ; Mon, 9 Dec 2013 14:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D91A20165 for ; Mon, 9 Dec 2013 14:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932662Ab3LIOiJ (ORCPT ); Mon, 9 Dec 2013 09:38:09 -0500 Received: from mail-qc0-f175.google.com ([209.85.216.175]:51212 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932572Ab3LIOiJ (ORCPT ); Mon, 9 Dec 2013 09:38:09 -0500 Received: by mail-qc0-f175.google.com with SMTP id e9so2797047qcy.34 for ; Mon, 09 Dec 2013 06:38:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=JRaj1jyenh3xMxWg1WzNkvt6quLPkozvkWCDRT+k2+0=; b=YS0bfkj737I6IjRuXVFAnxC6g2Kt6q3Y3HlPXQ9XRyw6uUTEDUU2hN00tAdFUBIylo LzKwXPpZ8yyfkJTzid0riEGzrdUCbWdUPHWi2xK0dvzZlZ+EC9EI7Dlg1hWvDQFtToHc Wnx4d5bslBFY7RrmsM39VmFaA0TxEQdGeSU0IoT4WEvGLqFkZta3pnI9UZE8+pLLxO0R +tV1i7yz8NPGI2MHbGGc3XteeKjOaXjILAfdTMArxxQ7YTx67u7xlSXpqRZ1spgheckn WG3dJxGKW+t3TxvCxAIs4P9GCPXRcRaI5bkB4JANm6Y7j839xSy5iApQs45cwxK8BgNa Ythw== X-Gm-Message-State: ALoCoQmVWV0QfZAjsrDoJapdSL4qCqJh27DCpmdfsJS4E3sG0PdDcHG2sb212wc4IQ2pe5J3Fb3V X-Received: by 10.224.51.74 with SMTP id c10mr35020425qag.7.1386599887075; Mon, 09 Dec 2013 06:38:07 -0800 (PST) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id u17sm30403790qeb.4.2013.12.09.06.38.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2013 06:38:06 -0800 (PST) From: Jeff Layton To: trondmy@gmail.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH] rpc_pipe: fix cleanup of dummy gssd directory when notification fails Date: Mon, 9 Dec 2013 09:38:00 -0500 Message-Id: <1386599880-20031-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.4.2 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, it could leak dentry references in some cases. Make sure we clean up properly. Signed-off-by: Jeff Layton --- net/sunrpc/rpc_pipe.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 5d973b2..b185548 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -1369,6 +1369,18 @@ out: return pipe_dentry; } +static void +rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry) +{ + struct dentry *clnt_dir = pipe_dentry->d_parent; + struct dentry *gssd_dir = clnt_dir->d_parent; + + __rpc_rmpipe(clnt_dir->d_inode, pipe_dentry); + __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1); + __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1); + dput(pipe_dentry); +} + static int rpc_fill_super(struct super_block *sb, void *data, int silent) { @@ -1412,7 +1424,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) return 0; err_depopulate: - dput(gssd_dentry); + rpc_gssd_dummy_depopulate(gssd_dentry); blocking_notifier_call_chain(&rpc_pipefs_notifier_list, RPC_PIPEFS_UMOUNT, sb);