From: Mike Waychison Subject: [patch 1/6][RFC] Keep FIBMAP from looking at negative block nrs Date: Fri, 26 Oct 2007 16:37:33 -0700 Message-ID: <20071026233847.864038076@crlf.corp.google.com> References: <20071026233732.568575496@crlf.corp.google.com> Cc: linux-kernel@vger.kernel.org, Mike Waychison To: linux-fsdevel@vger.kernel.org Return-path: Received: from smtp-out.google.com ([216.239.33.17]:3379 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764049AbXJZXix (ORCPT ); Fri, 26 Oct 2007 19:38:53 -0400 Content-Disposition: inline; filename=fix_negative_fibmap_blocks.patch Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Return an error if the user requests a negative logical block in a file. Signed-off-by: Mike Waychison fs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+) Index: linux-2.6.23/fs/ioctl.c =================================================================== --- linux-2.6.23.orig/fs/ioctl.c 2007-10-26 15:25:48.000000000 -0700 +++ linux-2.6.23/fs/ioctl.c 2007-10-26 16:16:29.000000000 -0700 @@ -60,6 +60,8 @@ static int file_ioctl(struct file *filp, return -EPERM; if ((error = get_user(block, p)) != 0) return error; + if (block < 0) + return -EINVAL; lock_kernel(); res = mapping->a_ops->bmap(mapping, block); --