shithub: lwext4

Download patch

ref: a4ec81fd03739007d083a7cc3bfaf5e548cefc8e
parent: 0b1f3afd3b8787ea652668ed29439d4701b42765
author: root <[email protected]>
date: Fri Oct 9 22:01:00 EDT 2015

FIX: EA in-memory data referred after freeing.

--- a/lwext4/ext4_xattr.c
+++ b/lwext4/ext4_xattr.c
@@ -408,10 +408,11 @@
 			xattr_ref->iter_from =
 			    RB_NEXT(ext4_xattr_tree, &xattr_ref->root, item);
 
-		RB_REMOVE(ext4_xattr_tree, &xattr_ref->root, item);
-		ext4_xattr_item_free(item);
 		xattr_ref->ea_size -= EXT4_XATTR_SIZE(item->data_size) +
 				      EXT4_XATTR_LEN(item->name_len);
+
+		RB_REMOVE(ext4_xattr_tree, &xattr_ref->root, item);
+		ext4_xattr_item_free(item);
 		xattr_ref->dirty = true;
 		ret = EOK;
 	}