2008-09-14 14:32:14

by Manish Katiyar

[permalink] [raw]
Subject: [PATCH] resize2fs : Fix potential memory corruption in ext2fs_progress_init()

Since "prog" is not initialized with 0 , below check in
ext2fs_progress_init() is wrong and may lead to corruptions.


Signed-off-by: Manish Katiyar <[email protected]>

---
resize/sim_progress.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/resize/sim_progress.c b/resize/sim_progress.c
index a575633..e7dba88 100644
--- a/resize/sim_progress.c
+++ b/resize/sim_progress.c
@@ -83,7 +83,7 @@ errcode_t ext2fs_progress_init(ext2_sim_progmeter *ret_prog,
errcode_t retval;

retval = ext2fs_get_mem(sizeof(struct ext2_sim_progress), &prog);
- if (!prog)
+ if (retval)
return retval;
memset(prog, 0, sizeof(struct ext2_sim_progress));

--
1.5.4.3


Thanks -
Manish


2008-09-16 07:22:58

by Manish Katiyar

[permalink] [raw]
Subject: Fwd: [PATCH] resize2fs : Fix potential memory corruption in ext2fs_progress_init()

---------- Forwarded message ----------
From: Manish Katiyar <[email protected]>
Date: Sun, Sep 14, 2008 at 8:02 PM
Subject: [PATCH] resize2fs : Fix potential memory corruption in
ext2fs_progress_init()
To: [email protected], Theodore Tso <[email protected]>
Cc: [email protected]


Since "prog" is not initialized with 0 , below check in
ext2fs_progress_init() is wrong and may lead to corruptions.


Signed-off-by: Manish Katiyar <[email protected]>

---
resize/sim_progress.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/resize/sim_progress.c b/resize/sim_progress.c
index a575633..e7dba88 100644
--- a/resize/sim_progress.c
+++ b/resize/sim_progress.c
@@ -83,7 +83,7 @@ errcode_t ext2fs_progress_init(ext2_sim_progmeter *ret_prog,
errcode_t retval;

retval = ext2fs_get_mem(sizeof(struct ext2_sim_progress), &prog);
- if (!prog)
+ if (retval)
return retval;
memset(prog, 0, sizeof(struct ext2_sim_progress));

--
1.5.4.3


Any ack/nack on this one ?? I also saw some utilities
(debugfs,resizefs) usage don't print the options specified in man
pages. Is it intentional ? Are they hidden options for developers ?

Thanks -
Manish


Thanks -
Manish

2008-10-01 23:50:50

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] resize2fs : Fix potential memory corruption in ext2fs_progress_init()G

On Sun, Sep 14, 2008 at 08:02:12PM +0530, Manish Katiyar wrote:
> Since "prog" is not initialized with 0 , below check in
> ext2fs_progress_init() is wrong and may lead to corruptions.

Thanks, applied. (Sorry for the delay; I've been really busy the past
two weeks.)

- Ted