From patchwork Mon Oct 17 06:11:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Yang X-Patchwork-Id: 120103 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B1E6FB6F90 for ; Mon, 17 Oct 2011 18:47:24 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752728Ab1JQHrW (ORCPT ); Mon, 17 Oct 2011 03:47:22 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:38743 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649Ab1JQHrV (ORCPT ); Mon, 17 Oct 2011 03:47:21 -0400 Received: by yxp4 with SMTP id 4so3430415yxp.5 for ; Mon, 17 Oct 2011 00:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=vmXwQrKqojS78aHjXtVFT3SzR/A7JOrMkpjJ8+UH1Io=; b=bQT3qaVPHL9ppYCHvN5qd0Qj8/SVCdMs511bfmG//+Z9j3tPnXf4pK+dXMsB8XwS88 h/ubErXJWry9EWGuzQqomzIyiYFlhmK3cKJo/VZGltP9SPksknuRdAcy8Hg//kIe1whC dx7it/jytd0WoRb9/4uGXfz+tQI0oPgu6MIMw= Received: by 10.68.4.201 with SMTP id m9mr36527942pbm.40.1318837640873; Mon, 17 Oct 2011 00:47:20 -0700 (PDT) Received: from localhost.localdomain ([159.226.43.42]) by mx.google.com with ESMTPS id ki1sm56136242pbb.3.2011.10.17.00.47.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Oct 2011 00:47:20 -0700 (PDT) From: Yongqiang Yang To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Yongqiang Yang Subject: [PATCH] ext4: fix wrong verification in ext4_ext_insert_index Date: Mon, 17 Oct 2011 14:11:07 +0800 Message-Id: <1318831867-8225-1-git-send-email-xiaoqiangnk@gmail.com> X-Mailer: git-send-email 1.7.5.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org After inserting an new index, current number of indexes should be greater than original number by 1. So if the new index is less or equal than LAST_INDEX + 1, then indexes are continugous. If new index will be placed on the end, then ix will equals LAST_INDEX + 1. Index entries has been verifiyed in pervious code in ext4_ext_insert_index. Signed-off-by: Yongqiang Yang --- fs/ext4/extents.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 2dff31e..322398e 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -779,7 +779,7 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode, ix = curp->p_idx; } - if (unlikely(ix > EXT_LAST_INDEX(curp->p_hdr))) { + if (unlikely(ix > EXT_LAST_INDEX(curp->p_hdr) + 1)) { EXT4_ERROR_INODE(inode, "ix > EXT_LAST_INDEX!"); return -EIO; }