Commit f79c4498 authored by Joakim Tjernlund's avatar Joakim Tjernlund Committed by David Woodhouse

[JFFS2] Prevent oops after 'node added in wrong place' debug check

jffs2_add_physical_node_ref() should never really return error -- it's
an internal debugging check which triggered. We really need to work out
why and stop it happening. But in the meantime, let's make the failure
mode a little less nasty.
Signed-off-by: default avatarJoakim Tjernlund <>
Signed-off-by: default avatarDavid Woodhouse <>
parent fab2c399
......@@ -173,6 +173,12 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
flash_ofs |= REF_NORMAL;
fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache);
if (IS_ERR(fn->raw)) {
void *hold_err = fn->raw;
/* Release the full_dnode which is now useless, and return */
return ERR_PTR(PTR_ERR(hold_err));
fn->ofs = je32_to_cpu(ri->offset);
fn->size = je32_to_cpu(ri->dsize);
fn->frags = 0;
......@@ -291,6 +297,12 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
/* Mark the space used */
fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache);
if (IS_ERR(fd->raw)) {
void *hold_err = fd->raw;
/* Release the full_dirent which is now useless, and return */
return ERR_PTR(PTR_ERR(hold_err));
if (retried) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment