diff options
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 93b22f661d9d..e3e37f7c8477 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1831,6 +1831,7 @@ struct buffered_dirent { | |||
1831 | struct readdir_data { | 1831 | struct readdir_data { |
1832 | char *dirent; | 1832 | char *dirent; |
1833 | size_t used; | 1833 | size_t used; |
1834 | int full; | ||
1834 | }; | 1835 | }; |
1835 | 1836 | ||
1836 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | 1837 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, |
@@ -1841,8 +1842,10 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | |||
1841 | unsigned int reclen; | 1842 | unsigned int reclen; |
1842 | 1843 | ||
1843 | reclen = ALIGN(sizeof(struct buffered_dirent) + namlen, sizeof(u64)); | 1844 | reclen = ALIGN(sizeof(struct buffered_dirent) + namlen, sizeof(u64)); |
1844 | if (buf->used + reclen > PAGE_SIZE) | 1845 | if (buf->used + reclen > PAGE_SIZE) { |
1846 | buf->full = 1; | ||
1845 | return -EINVAL; | 1847 | return -EINVAL; |
1848 | } | ||
1846 | 1849 | ||
1847 | de->namlen = namlen; | 1850 | de->namlen = namlen; |
1848 | de->offset = offset; | 1851 | de->offset = offset; |
@@ -1874,9 +1877,13 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1874 | unsigned int reclen; | 1877 | unsigned int reclen; |
1875 | 1878 | ||
1876 | buf.used = 0; | 1879 | buf.used = 0; |
1880 | buf.full = 0; | ||
1877 | 1881 | ||
1878 | host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf); | 1882 | host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf); |
1879 | if (host_err) | 1883 | if (buf.full) |
1884 | host_err = 0; | ||
1885 | |||
1886 | if (host_err < 0) | ||
1880 | break; | 1887 | break; |
1881 | 1888 | ||
1882 | size = buf.used; | 1889 | size = buf.used; |