A reference to LEB 0 or with length 0 in the TNC
is never correct and could be caused by a memory corruption.
Don't write such a bad index node to the MTD.
Instead fail the commit which will turn UBIFS into read-only mode.
This is less painful than having the bad reference on the MTD
from where UBFIS has no chance to recover.
Signed-off-by: Richard Weinberger <richard@nod.at>
                        ubifs_dump_znode(c, znode);
                        if (zbr->znode)
                                ubifs_dump_znode(c, zbr->znode);
+
+                       return -EINVAL;
                }
        }
        ubifs_prepare_node(c, idx, len, 0);
                                ubifs_dump_znode(c, znode);
                                if (zbr->znode)
                                        ubifs_dump_znode(c, zbr->znode);
+
+                               return -EINVAL;
                        }
                }
                len = ubifs_idx_node_sz(c, znode->child_cnt);