From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trond Myklebust Subject: [PATCH 4/5] NFS: Fix nfs_path() to always return a '/' at the beginning of the path Date: Mon, 22 Jun 2009 15:09:14 -0400 Message-ID: <20090622190914.27923.80056.stgit@heimdal.trondhjem.org> References: <20090622190913.27923.31665.stgit@heimdal.trondhjem.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: Al Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org To: Linus Torvalds Return-path: Received: from mx2.netapp.com ([216.240.18.37]:6269 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752220AbZFVTU6 (ORCPT ); Mon, 22 Jun 2009 15:20:58 -0400 In-Reply-To: <20090622190913.27923.31665.stgit-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org> Sender: linux-nfs-owner@vger.kernel.org List-ID: Signed-off-by: Trond Myklebust --- fs/nfs/namespace.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index f01caec..40c7667 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -65,6 +65,11 @@ char *nfs_path(const char *base, dentry = dentry->d_parent; } spin_unlock(&dcache_lock); + if (*end != '/') { + if (--buflen < 0) + goto Elong; + *--end = '/'; + } namelen = strlen(base); /* Strip off excess slashes in base string */ while (namelen > 0 && base[namelen - 1] == '/')