Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309976
b: refs/heads/master
c: 863ced7
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed May 30, 2012
1 parent f435809 commit 6526897
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2bd6c11cd05fed1eeb83230e87351357d72bb48
refs/heads/master: 863ced7fe762f80e67bc9171e47c7d80032cce12
33 changes: 14 additions & 19 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,12 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
{
int error;
struct file *file;
int fput_needed;
struct compat_readdir_callback buf;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.result = 0;
buf.dirent = dirent;
Expand All @@ -885,8 +885,7 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
if (buf.result)
error = buf.result;

fput(file);
out:
fput_light(file, fput_needed);
return error;
}

Expand Down Expand Up @@ -953,16 +952,15 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
struct file * file;
struct compat_linux_dirent __user * lastdirent;
struct compat_getdents_callback buf;
int fput_needed;
int error;

error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
return -EFAULT;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.current_dir = dirent;
buf.previous = NULL;
Expand All @@ -979,8 +977,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
else
error = count - buf.count;
}
fput(file);
out:
fput_light(file, fput_needed);
return error;
}

Expand Down Expand Up @@ -1041,16 +1038,15 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
struct file * file;
struct linux_dirent64 __user * lastdirent;
struct compat_getdents_callback64 buf;
int fput_needed;
int error;

error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
return -EFAULT;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.current_dir = dirent;
buf.previous = NULL;
Expand All @@ -1068,8 +1064,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
else
error = count - buf.count;
}
fput(file);
out:
fput_light(file, fput_needed);
return error;
}
#endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */
Expand Down
33 changes: 14 additions & 19 deletions trunk/fs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
int error;
struct file * file;
struct readdir_callback buf;
int fput_needed;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.result = 0;
buf.dirent = dirent;
Expand All @@ -121,8 +121,7 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
if (buf.result)
error = buf.result;

fput(file);
out:
fput_light(file, fput_needed);
return error;
}

Expand Down Expand Up @@ -195,16 +194,15 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd,
struct file * file;
struct linux_dirent __user * lastdirent;
struct getdents_callback buf;
int fput_needed;
int error;

error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
return -EFAULT;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.current_dir = dirent;
buf.previous = NULL;
Expand All @@ -221,8 +219,7 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd,
else
error = count - buf.count;
}
fput(file);
out:
fput_light(file, fput_needed);
return error;
}

Expand Down Expand Up @@ -278,16 +275,15 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd,
struct file * file;
struct linux_dirent64 __user * lastdirent;
struct getdents_callback64 buf;
int fput_needed;
int error;

error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
return -EFAULT;

error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;
return -EBADF;

buf.current_dir = dirent;
buf.previous = NULL;
Expand All @@ -305,7 +301,6 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd,
else
error = count - buf.count;
}
fput(file);
out:
fput_light(file, fput_needed);
return error;
}

0 comments on commit 6526897

Please sign in to comment.