Way back in 2002, commit
948ce18 fixed a potential use-after-free
in verify_final_da_path, but the same fix was not applied to
verify_final_dir2_path; apply it now.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
const int p_level)
{
xfs_da_intnode_t *node;
+ xfs_dahash_t hashval;
int bad = 0;
int entry;
int this_level = p_level + 1;
}
}
+ /*
+ * Note: squirrel hashval away _before_ releasing the
+ * buffer, preventing a use-after-free problem.
+ */
+ hashval = be32_to_cpu(btree[entry].hashval);
+
/*
* release/write buffer
*/
* set hashvalue to correctl reflect the now-validated
* last entry in this block and continue upwards validation
*/
- cursor->level[this_level].hashval = be32_to_cpu(btree[entry].hashval);
+ cursor->level[this_level].hashval = hashval;
return(verify_final_dir2_path(mp, cursor, this_level));
}