Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932643AbbKMDiC (ORCPT ); Thu, 12 Nov 2015 22:38:02 -0500 Received: from g9t5008.houston.hp.com ([15.240.92.66]:44270 "EHLO g9t5008.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754507AbbKMDiA convert rfc822-to-8bit (ORCPT ); Thu, 12 Nov 2015 22:38:00 -0500 From: "Seymour, Shane M" To: "Darrick J. Wong" CC: Jens Axboe , Christoph Hellwig , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-api@vger.kernel.org" , Jeff Layton , "J. Bruce Fields" , "martin.petersen@oracle.com" Subject: RE: [PATCH] block: create ioctl to discard-or-zeroout a range of blocks Thread-Topic: [PATCH] block: create ioctl to discard-or-zeroout a range of blocks Thread-Index: AQHRG3bpCSLWwRku1USJ2RZTZkapa56WNDAQgAAlW4CAAt/l0A== Date: Fri, 13 Nov 2015 03:36:21 +0000 Message-ID: References: <20151110051526.GA2217@birch.djwong.org> <20151111061435.GA32272@birch.djwong.org> In-Reply-To: <20151111061435.GA32272@birch.djwong.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.29] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 947 Lines: 11 > I don't have a device large enough to test for signedness errors, since passing > huge values for start and len never make it past the i_size_read check. If you have someone trying to bypass your sanity checks then if start=18446744073709551104 and len=1024 the result of adding them together will be 512 (subtracting an extra 1 in the patched code to get 511 for end). That will pass the i_size_read check won't it? If so that would cause lstart in truncate_inode_pages_range() to be -512. I don't know what truncate_inode_pages_range() will do with a negative lstart value like that but it seems like an unusual value for your code to be willing to pass into truncate_inode_pages_range(). Shane -- 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/