diff options
author | Wagner Popov dos Santos | 2021-02-23 00:49:00 -0300 |
---|---|---|
committer | Tom Rini | 2021-04-07 10:22:22 -0400 |
commit | fc25ffe7d2277ff043f76821452bfc8d05a80bd7 (patch) | |
tree | e41615bb0ce59e7114f1db4852a73a4c3df08219 /fs | |
parent | 610a2cc7a38782bf2fa5c1037959a42838ebb2ad (diff) |
JFFS2: fix jffs2 summary datacrc status uninitialized
The function jffs2_1pass_read_inode() was discarding the summary
inodes and dirent because the value in datacrc flag wasn't
initialized in function jffs2_sum_process_sum_data().
This fix initializes the status of all summary records to indicate
that the CRC needs to be verified when they are loaded.
Before this fix, the behaviors produced by the undefined value of
datacrc was:
- Summary's registries were discarded when 'b->datacrc' is equal
as 'CRC_BAD'.
- Summary's registries were not checked when b->datacrc differs of
'CRC_BAD' and 'CRC_UNKNOWN'
So, almost all of the time the crc just isn't checked, and in some
cases the registries are discarded.
Signed-off-by: Wagner Popov dos Santos <wpopov@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/jffs2_1pass.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index b39943671c9..1818e812156 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -1293,6 +1293,7 @@ static int jffs2_sum_process_sum_data(struct part_info *part, uint32_t offset, &spi->version); b->ino = sum_get_unaligned32( &spi->inode); + b->datacrc = CRC_UNKNOWN; } sp += JFFS2_SUMMARY_INODE_SIZE; @@ -1314,6 +1315,7 @@ static int jffs2_sum_process_sum_data(struct part_info *part, uint32_t offset, &spd->version); b->pino = sum_get_unaligned32( &spd->pino); + b->datacrc = CRC_UNKNOWN; } sp += JFFS2_SUMMARY_DIRENT_SIZE( |