mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
[PATCH] fix regular readdir() and friends
Handling of -EOVERFLOW. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
da574983de
commit
8f3f655da7
2 changed files with 12 additions and 4 deletions
|
@ -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,
|
||||||
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
|
||||||
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,
|
||||||
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))
|
||||||
|
|
Loading…
Add table
Reference in a new issue