Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756598AbZDTO6h (ORCPT ); Mon, 20 Apr 2009 10:58:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755850AbZDTO62 (ORCPT ); Mon, 20 Apr 2009 10:58:28 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:33623 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754898AbZDTO61 (ORCPT ); Mon, 20 Apr 2009 10:58:27 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:message-id:from:to:cc:subject:user-agent:mime-version :content-type; b=WK+XGXHY6aq15ZxHnzf2XZFTHCH5VX/KnK2WjhfYgYUV1CldI2JPL4bUOlPsCUWgnN lf60zfOmS/pXSuTqiKuJdaTj9ZRbH7aiYUxwbraypBx/RA1pgNsuv/mSUJQ5ooifKzSj OfmvlFxGuvmG/LTlF/7WBBOAvDUeQjS3Lf89Y= Date: Mon, 20 Apr 2009 16:58:32 +0200 Message-ID: <87eivn5q3r.wl%vmayatsk@redhat.com> From: Vitaly Mayatskikh To: linux-kernel@vger.kernel.org Cc: Thomas Tuttle , Andrew Morton Subject: [PATCH] pagemap: require aligned-length, non-null reads of /proc/pid/pagemap User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/22.3 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 970 Lines: 31 The intention of commit aae8679b0ebcaa92f99c1c3cb0cd651594a43915 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 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 39e4ad4..6f61b7c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -665,6 +665,10 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, goto out_task; ret = 0; + + if (!count) + goto out_task; + mm = get_task_mm(task); if (!mm) goto out_task; -- wbr, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/