give readdir(2)/getdents(2)/etc. uniform exclusion with lseek()
same as read() on regular files has, and for the same reason. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Этот коммит содержится в:
12
fs/readdir.c
12
fs/readdir.c
@@ -112,7 +112,7 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
|
||||
struct old_linux_dirent __user *, dirent, unsigned int, count)
|
||||
{
|
||||
int error;
|
||||
struct fd f = fdget(fd);
|
||||
struct fd f = fdget_pos(fd);
|
||||
struct readdir_callback buf = {
|
||||
.ctx.actor = fillonedir,
|
||||
.dirent = dirent
|
||||
@@ -125,7 +125,7 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
|
||||
if (buf.result)
|
||||
error = buf.result;
|
||||
|
||||
fdput(f);
|
||||
fdput_pos(f);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd,
|
||||
if (!access_ok(VERIFY_WRITE, dirent, count))
|
||||
return -EFAULT;
|
||||
|
||||
f = fdget(fd);
|
||||
f = fdget_pos(fd);
|
||||
if (!f.file)
|
||||
return -EBADF;
|
||||
|
||||
@@ -223,7 +223,7 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd,
|
||||
else
|
||||
error = count - buf.count;
|
||||
}
|
||||
fdput(f);
|
||||
fdput_pos(f);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd,
|
||||
if (!access_ok(VERIFY_WRITE, dirent, count))
|
||||
return -EFAULT;
|
||||
|
||||
f = fdget(fd);
|
||||
f = fdget_pos(fd);
|
||||
if (!f.file)
|
||||
return -EBADF;
|
||||
|
||||
@@ -305,6 +305,6 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd,
|
||||
else
|
||||
error = count - buf.count;
|
||||
}
|
||||
fdput(f);
|
||||
fdput_pos(f);
|
||||
return error;
|
||||
}
|
||||
|
Ссылка в новой задаче
Block a user