diff options
| -rw-r--r-- | fs/nfsd/nfs4xdr.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index c2a4701d7286..d9454fe5653f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -1816,10 +1816,7 @@ static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, | |||
| 1816 | static __be32 nfsd4_encode_path(const struct path *root, | 1816 | static __be32 nfsd4_encode_path(const struct path *root, |
| 1817 | const struct path *path, __be32 **pp, int *buflen) | 1817 | const struct path *path, __be32 **pp, int *buflen) |
| 1818 | { | 1818 | { |
| 1819 | struct path cur = { | 1819 | struct path cur = *path; |
| 1820 | .mnt = path->mnt, | ||
| 1821 | .dentry = path->dentry, | ||
| 1822 | }; | ||
| 1823 | __be32 *p = *pp; | 1820 | __be32 *p = *pp; |
| 1824 | struct dentry **components = NULL; | 1821 | struct dentry **components = NULL; |
| 1825 | unsigned int ncomponents = 0; | 1822 | unsigned int ncomponents = 0; |
| @@ -1859,14 +1856,19 @@ static __be32 nfsd4_encode_path(const struct path *root, | |||
| 1859 | 1856 | ||
| 1860 | while (ncomponents) { | 1857 | while (ncomponents) { |
| 1861 | struct dentry *dentry = components[ncomponents - 1]; | 1858 | struct dentry *dentry = components[ncomponents - 1]; |
| 1862 | unsigned int len = dentry->d_name.len; | 1859 | unsigned int len; |
| 1863 | 1860 | ||
| 1861 | spin_lock(&dentry->d_lock); | ||
| 1862 | len = dentry->d_name.len; | ||
| 1864 | *buflen -= 4 + (XDR_QUADLEN(len) << 2); | 1863 | *buflen -= 4 + (XDR_QUADLEN(len) << 2); |
| 1865 | if (*buflen < 0) | 1864 | if (*buflen < 0) { |
| 1865 | spin_unlock(&dentry->d_lock); | ||
| 1866 | goto out_free; | 1866 | goto out_free; |
| 1867 | } | ||
| 1867 | WRITE32(len); | 1868 | WRITE32(len); |
| 1868 | WRITEMEM(dentry->d_name.name, len); | 1869 | WRITEMEM(dentry->d_name.name, len); |
| 1869 | dprintk("/%s", dentry->d_name.name); | 1870 | dprintk("/%s", dentry->d_name.name); |
| 1871 | spin_unlock(&dentry->d_lock); | ||
| 1870 | dput(dentry); | 1872 | dput(dentry); |
| 1871 | ncomponents--; | 1873 | ncomponents--; |
| 1872 | } | 1874 | } |
