瀏覽代碼

NFS: Fix nfs_path() to always return a '/' at the beginning of the path

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Trond Myklebust 16 年之前
父節點
當前提交
0b75b35c7c
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      fs/nfs/namespace.c

+ 5 - 0
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] == '/')