diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2013-08-19 12:30:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-19 12:47:27 -0400 |
commit | 94fc5d9de5bd757ad46f0d94bc4ebf617c4487f6 (patch) | |
tree | 84cc97ed83166e4d9f074dc3d47ba301579f34bf /fs | |
parent | d6a5e06cd17a3f901231e345e4acc1c3dab9fbb8 (diff) |
proc: return on proc_readdir error
Commit f0c3b5093add ("[readdir] convert procfs") introduced a bug on the
listing of the proc file-system. The return value of proc_readdir()
isn't tested anymore in the proc_root_readdir function.
This lead to an "interesting" behaviour when we are using the getdents()
system call with a buffer too small: instead of failing, it returns the
first entries of /proc (enough to fill the given buffer), plus the PID
directories.
This is not triggered on glibc (as getdents is called with a 32KB
buffer), but on uclibc, the buffer size is only 1KB, thus some proc
entries are missing.
See https://lkml.org/lkml/2013/8/12/288 for more background.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/root.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c index 229e366598da..e0a790da726d 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -205,7 +205,9 @@ static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentr | |||
205 | static int proc_root_readdir(struct file *file, struct dir_context *ctx) | 205 | static int proc_root_readdir(struct file *file, struct dir_context *ctx) |
206 | { | 206 | { |
207 | if (ctx->pos < FIRST_PROCESS_ENTRY) { | 207 | if (ctx->pos < FIRST_PROCESS_ENTRY) { |
208 | proc_readdir(file, ctx); | 208 | int error = proc_readdir(file, ctx); |
209 | if (unlikely(error <= 0)) | ||
210 | return error; | ||
209 | ctx->pos = FIRST_PROCESS_ENTRY; | 211 | ctx->pos = FIRST_PROCESS_ENTRY; |
210 | } | 212 | } |
211 | 213 | ||