aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>2007-06-24 13:22:29 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-08-02 16:36:35 -0400
commit5bd5c03c317085339deb044ba52fce131a6a0b67 (patch)
tree2d4b7691136f6069ef074c5f7b2b872f2ecd9f2d /fs/jffs2
parent370504cf7c68b953de55c41d5e0be97d30f3cf00 (diff)
[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: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/write.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index c9fe0ab3a329..1406f2ce20a7 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -173,6 +173,12 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
173 flash_ofs |= REF_NORMAL; 173 flash_ofs |= REF_NORMAL;
174 } 174 }
175 fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache); 175 fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache);
176 if (IS_ERR(fn->raw)) {
177 void *hold_err = fn->raw;
178 /* Release the full_dnode which is now useless, and return */
179 jffs2_free_full_dnode(fn);
180 return ERR_PTR(PTR_ERR(hold_err));
181 }
176 fn->ofs = je32_to_cpu(ri->offset); 182 fn->ofs = je32_to_cpu(ri->offset);
177 fn->size = je32_to_cpu(ri->dsize); 183 fn->size = je32_to_cpu(ri->dsize);
178 fn->frags = 0; 184 fn->frags = 0;
@@ -291,6 +297,12 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
291 } 297 }
292 /* Mark the space used */ 298 /* Mark the space used */
293 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache); 299 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache);
300 if (IS_ERR(fd->raw)) {
301 void *hold_err = fd->raw;
302 /* Release the full_dirent which is now useless, and return */
303 jffs2_free_full_dirent(fd);
304 return ERR_PTR(PTR_ERR(hold_err));
305 }
294 306
295 if (retried) { 307 if (retried) {
296 jffs2_dbg_acct_sanity_check(c,NULL); 308 jffs2_dbg_acct_sanity_check(c,NULL);