Commit 8f3f655d authored by Al Viro's avatar Al Viro

[PATCH] fix regular readdir() and friends

Handling of -EOVERFLOW.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent da574983
...@@ -792,8 +792,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen, ...@@ -792,8 +792,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen,
if (buf->result) if (buf->result)
return -EINVAL; return -EINVAL;
d_ino = ino; d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->result = -EOVERFLOW;
return -EOVERFLOW; return -EOVERFLOW;
}
buf->result++; buf->result++;
dirent = buf->dirent; dirent = buf->dirent;
if (!access_ok(VERIFY_WRITE, dirent, if (!access_ok(VERIFY_WRITE, dirent,
...@@ -862,8 +864,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen, ...@@ -862,8 +864,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen,
if (reclen > buf->count) if (reclen > buf->count)
return -EINVAL; return -EINVAL;
d_ino = ino; d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->error = -EOVERFLOW;
return -EOVERFLOW; return -EOVERFLOW;
}
dirent = buf->previous; dirent = buf->previous;
if (dirent) { if (dirent) {
if (__put_user(offset, &dirent->d_off)) if (__put_user(offset, &dirent->d_off))
......
...@@ -80,8 +80,10 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset ...@@ -80,8 +80,10 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset
if (buf->result) if (buf->result)
return -EINVAL; return -EINVAL;
d_ino = ino; d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->result = -EOVERFLOW;
return -EOVERFLOW; return -EOVERFLOW;
}
buf->result++; buf->result++;
dirent = buf->dirent; dirent = buf->dirent;
if (!access_ok(VERIFY_WRITE, dirent, if (!access_ok(VERIFY_WRITE, dirent,
...@@ -155,8 +157,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ...@@ -155,8 +157,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
if (reclen > buf->count) if (reclen > buf->count)
return -EINVAL; return -EINVAL;
d_ino = ino; d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->error = -EOVERFLOW;
return -EOVERFLOW; return -EOVERFLOW;
}
dirent = buf->previous; dirent = buf->previous;
if (dirent) { if (dirent) {
if (__put_user(offset, &dirent->d_off)) if (__put_user(offset, &dirent->d_off))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment