Skip to contentSkip to conversation

ocfs2: potential ERR_PTR dereference on error paths

PATCH In review Dan Carpenter 4 participants 4 messages Apr 22, 2010 – May 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: potential ERR_PTR dereference on error paths

If "handle" is non null at the end of the function then we assume it's a valid pointer and pass it to ocfs2_commit_trans();

fs/ocfs2/inode.c +1 -0
index 07cc8bb..ae8e161 100644
@@ -558,6 +558,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
 		handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
 		if (IS_ERR(handle)) {
 			status = PTR_ERR(handle);
+			handle = NULL;
 			mlog_errno(status);
 			goto out;
 		}
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

If "handle" is non null at the end of the function then we assume it's a valid pointer and pass it to ocfs2_commit_trans();

fs/ocfs2/inode.c +0 -0
index 07cc8bb..ae8e161 100644

fs/ocfs2/inode.c static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, · line 564

Quoted 7 lines
fs/ocfs2/inode.c +1 -0
@@ -558,6 +558,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
 		handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
 		if (IS_ERR(handle)) {
 			status = PTR_ERR(handle);
+			handle = NULL;
 			mlog_errno(status);
 			goto out;
 		}

Good catch.

#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Dan Carpenter

If "handle" is non null at the end of the function then we assume it's a valid pointer and pass it to ocfs2_commit_trans();

This patch is now in the 'fixes' branch of ocfs2.git.

Joel

Signature · 10 lines
"And yet I fight,
 And yet I fight this battle all alone.
 No one to cry to;
 No place to call home."

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127