* [PATCH] ext4: fix wrong verification in ext4_ext_insert_index
@ 2011-10-17 6:11 Yongqiang Yang
2011-10-17 8:49 ` Tao Ma
0 siblings, 1 reply; 3+ messages in thread
From: Yongqiang Yang @ 2011-10-17 6:11 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, Yongqiang Yang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: fix wrong verification in ext4_ext_insert_index
2011-10-17 6:11 [PATCH] ext4: fix wrong verification in ext4_ext_insert_index Yongqiang Yang
@ 2011-10-17 8:49 ` Tao Ma
2011-10-17 9:00 ` Yongqiang Yang
0 siblings, 1 reply; 3+ messages in thread
From: Tao Ma @ 2011-10-17 8:49 UTC (permalink / raw)
To: Yongqiang Yang; +Cc: linux-ext4, tytso
Hi yongqiang,
On 10/17/2011 02:11 PM, Yongqiang Yang wrote:
> 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.
Thanks for the effort. But actually this is caused by my original patch
4fd30c033, and your fix doesn't resolve the problem I want to fix. So
consider ix is already overflow, the check can't prevent it from
stamping on the memory after this extent block. I have sent another fix
for it.
Thanks
Tao
>
> 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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: fix wrong verification in ext4_ext_insert_index
2011-10-17 8:49 ` Tao Ma
@ 2011-10-17 9:00 ` Yongqiang Yang
0 siblings, 0 replies; 3+ messages in thread
From: Yongqiang Yang @ 2011-10-17 9:00 UTC (permalink / raw)
To: Tao Ma; +Cc: linux-ext4, tytso
On Mon, Oct 17, 2011 at 4:49 PM, Tao Ma <tm@tao.ma> wrote:
> Hi yongqiang,
> On 10/17/2011 02:11 PM, Yongqiang Yang wrote:
>> 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.
> Thanks for the effort. But actually this is caused by my original patch
> 4fd30c033, and your fix doesn't resolve the problem I want to fix. So
> consider ix is already overflow, the check can't prevent it from
> stamping on the memory after this extent block. I have sent another fix
> for it.
Thanks!
Sorry! My working tree is not up to date:-)
Yongqiang.
>
> Thanks
> Tao
>>
>> 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;
>> }
>
>
--
Best Wishes
Yongqiang Yang
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-17 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 6:11 [PATCH] ext4: fix wrong verification in ext4_ext_insert_index Yongqiang Yang
2011-10-17 8:49 ` Tao Ma
2011-10-17 9:00 ` Yongqiang Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox