diff options
author | Earl Chew <echew@ixiacom.com> | 2012-03-21 23:33:43 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-22 00:54:54 (GMT) |
commit | 7904ac84244b59f536c2a5d1066a10f46df07b08 (patch) | |
tree | 82d9c44c26b52954884a70f1ae2b7fa78ea8e633 /arch/xtensa | |
parent | dc716e96f5a467835e8121e1caaf25d66a901cb3 (diff) | |
download | linux-7904ac84244b59f536c2a5d1066a10f46df07b08.tar.xz |
seq_file: fix mishandling of consecutive pread() invocations.
The following program illustrates the problem:
char buf[8192];
int fd = open("/proc/self/maps", O_RDONLY);
n = pread(fd, buf, sizeof(buf), 0);
printf("%d\n", n);
/* lseek(fd, 0, SEEK_CUR); */ /* Uncomment to work around */
n = pread(fd, buf, sizeof(buf), 0);
printf("%d\n", n);
The second printf() prints zero, but uncommenting the lseek() corrects its
behaviour.
To fix, make seq_read() mirror seq_lseek() when processing changes in
*ppos. Restore m->version first, then if required traverse and update
read_pos on success.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=11856
Signed-off-by: Earl Chew <echew@ixiacom.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/xtensa')
0 files changed, 0 insertions, 0 deletions