From: Yongqiang Yang <xiaoqiangnk@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Yongqiang Yang <xiaoqiangnk@gmail.com>
Subject: [PATCH] ext4: fix wrong verification in ext4_ext_insert_index
Date: Mon, 17 Oct 2011 14:11:07 +0800 [thread overview]
Message-ID: <1318831867-8225-1-git-send-email-xiaoqiangnk@gmail.com> (raw)
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 <xiaoqiangnk@gmail.com>
---
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;
}
--
1.7.5.1
next reply other threads:[~2011-10-17 7:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-17 6:11 Yongqiang Yang [this message]
2011-10-17 8:49 ` [PATCH] ext4: fix wrong verification in ext4_ext_insert_index Tao Ma
2011-10-17 9:00 ` Yongqiang Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318831867-8225-1-git-send-email-xiaoqiangnk@gmail.com \
--to=xiaoqiangnk@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox