Dan Carpenter
2013-Aug-01 13:55 UTC
[Ocfs2-devel] [patch] ocfs2: fix recent memory corruption bug
The pointer math in 6fdf3af1d2 "ocfs2: fix null pointer dereference in
ocfs2_dir_foreach_blk_id()" isn't correct so it will zero out the wrong
memory.
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
Static checker stuff.
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index c91d986..6942c22 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2157,8 +2157,7 @@ int ocfs2_empty_dir(struct inode *inode)
.ctx.pos = 0,
};
- memset(&priv + sizeof(struct dir_context), 0,
- sizeof(priv) - sizeof(struct dir_context));
+ memset(&priv.seen_dot, 0, sizeof(priv) - sizeof(struct dir_context));
if (ocfs2_dir_indexed(inode)) {
ret = ocfs2_empty_dir_dx(inode, &priv);
Dan Carpenter
2013-Aug-01 13:58 UTC
[Ocfs2-devel] [patch] ocfs2: fix recent memory corruption bug
On Thu, Aug 01, 2013 at 04:55:26PM +0300, Dan Carpenter wrote:> The pointer math in 6fdf3af1d2 "ocfs2: fix null pointer dereference in > ocfs2_dir_foreach_blk_id()" isn't correct so it will zero out the wrong > memory. >I sent this patch prematurely... Really the memset is not needed because the values are already initialized to zero. Let me send a v2 patch that removes the memset. Sorry, I just wanted to fix this right away because of the memory corruption. regards, dan carpenter