pagemap: require aligned-length, non-null reads of /proc/pid/pagemap
commitc7273beb2266d3058ef299e2135be7edce5cd03f
authorVitaly Mayatskikh <v.mayatskih@gmail.com>
Thu, 30 Apr 2009 22:08:18 +0000 (30 15:08 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 May 2009 21:54:34 +0000 (8 14:54 -0700)
treea2c1ae91a7e843c93a87ec8b1b990623a69248ab
parentf3fb397564e99368f0979933c6ee5fe2d3887668
pagemap: require aligned-length, non-null reads of /proc/pid/pagemap

commit 0816178638c15ce5472d39d771a96860dff4141a upstream.

The intention of commit aae8679b0ebcaa92f99c1c3cb0cd651594a43915
("pagemap: fix bug in add_to_pagemap, require aligned-length reads of
/proc/pid/pagemap") was to force reads of /proc/pid/pagemap to be a
multiple of 8 bytes, but now it allows to read 0 bytes, which actually
puts some data to user's buffer.  According to POSIX, if count is zero,
read() should return zero and has no other results.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>
Cc: Thomas Tuttle <ttuttle@google.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/proc/task_mmu.c