aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-08-12 00:28:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-08-25 01:18:08 -0400
commit8f3f655da7288504c1013621090ecc940173ae1c (patch)
treeadd84c360aaf940d721166ff2685a27c094cf799 /fs
parentda574983de9f9283ba35662c8723627096e160de (diff)
[PATCH] fix regular readdir() and friends
Handling of -EOVERFLOW. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c8
-rw-r--r--fs/readdir.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/fs/compat.c b/fs/compat.c
index c9d1472e65c5..075d0509970d 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -792,8 +792,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen,
792 if (buf->result) 792 if (buf->result)
793 return -EINVAL; 793 return -EINVAL;
794 d_ino = ino; 794 d_ino = ino;
795 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) 795 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
796 buf->result = -EOVERFLOW;
796 return -EOVERFLOW; 797 return -EOVERFLOW;
798 }
797 buf->result++; 799 buf->result++;
798 dirent = buf->dirent; 800 dirent = buf->dirent;
799 if (!access_ok(VERIFY_WRITE, dirent, 801 if (!access_ok(VERIFY_WRITE, dirent,
@@ -862,8 +864,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen,
862 if (reclen > buf->count) 864 if (reclen > buf->count)
863 return -EINVAL; 865 return -EINVAL;
864 d_ino = ino; 866 d_ino = ino;
865 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) 867 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
868 buf->error = -EOVERFLOW;
866 return -EOVERFLOW; 869 return -EOVERFLOW;
870 }
867 dirent = buf->previous; 871 dirent = buf->previous;
868 if (dirent) { 872 if (dirent) {
869 if (__put_user(offset, &dirent->d_off)) 873 if (__put_user(offset, &dirent->d_off))
diff --git a/fs/readdir.c b/fs/readdir.c
index 4e026e5407fb..93a7559bbfd8 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -80,8 +80,10 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset
80 if (buf->result) 80 if (buf->result)
81 return -EINVAL; 81 return -EINVAL;
82 d_ino = ino; 82 d_ino = ino;
83 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) 83 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
84 buf->result = -EOVERFLOW;
84 return -EOVERFLOW; 85 return -EOVERFLOW;
86 }
85 buf->result++; 87 buf->result++;
86 dirent = buf->dirent; 88 dirent = buf->dirent;
87 if (!access_ok(VERIFY_WRITE, dirent, 89 if (!access_ok(VERIFY_WRITE, dirent,
@@ -155,8 +157,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
155 if (reclen > buf->count) 157 if (reclen > buf->count)
156 return -EINVAL; 158 return -EINVAL;
157 d_ino = ino; 159 d_ino = ino;
158 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) 160 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
161 buf->error = -EOVERFLOW;
159 return -EOVERFLOW; 162 return -EOVERFLOW;
163 }
160 dirent = buf->previous; 164 dirent = buf->previous;
161 if (dirent) { 165 if (dirent) {
162 if (__put_user(offset, &dirent->d_off)) 166 if (__put_user(offset, &dirent->d_off))