[PATCH] jffs2: initialize datacrc for inode/dirent entries built from scan
Wagner Popov dos Santos <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
jffs2_1pass_build_lists() initializes inode and dirent list entries from raw node scanning, but leaves b->datacrc uninitialized in both paths. Later, jffs2_1pass_read_inode() uses b->datacrc to decide whether to compute and validate the node data CRC, or to discard the entry as CRC_BAD. With an undefined value, behavior is non-deterministic: entries may be incorrectly dropped or CRC verification may be skipped. Initialize b->datacrc to CRC_UNKNOWN for inode and dirent entries created in jffs2_1pass_build_lists(), matching the summary-based path behavior. Signed-off-by: Wagner Popov dos Santos <[email protected]> --- fs/jffs2/jffs2_1pass.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index 137a9585b0b..eb0554f466f 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -1726,6 +1726,7 @@ jffs2_1pass_build_lists(struct part_info * part) b->offset = (u32)part->offset + ofs; b->version = node->i.version; b->ino = node->i.ino; + b->datacrc = CRC_UNKNOWN; if (max_totlen < node->u.totlen) max_totlen = node->u.totlen; break; @@ -1764,6 +1765,7 @@ jffs2_1pass_build_lists(struct part_info * part) b->offset = (u32)part->offset + ofs; b->version = node->d.version; b->pino = node->d.pino; + b->datacrc = CRC_UNKNOWN; if (max_totlen < node->u.totlen) max_totlen = node->u.totlen; counterN++; -- 2.43.0