summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorEarl Chew <echew@ixiacom.com>2012-03-21 16:33:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 17:54:54 -0700
commit7904ac84244b59f536c2a5d1066a10f46df07b08 (patch)
tree82d9c44c26b52954884a70f1ae2b7fa78ea8e633 /arch
parentdc716e96f5a467835e8121e1caaf25d66a901cb3 (diff)
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')
0 files changed, 0 insertions, 0 deletions