mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
dm verity: correcting logic used with corrupted_errs counter
Current logic on handling corrupted_errs countes is not considering DM_VERITY_MAX_CORRUPTED_ERRS limit so correcting the logic. Change-Id: Ide3f3e6b9d8bec8f02cbb5a72b7d0935bcd87826 Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
This commit is contained in:
parent
ce480240e1
commit
b649934e08
1 changed files with 7 additions and 3 deletions
|
|
@ -220,8 +220,10 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
|
|||
/* Corruption should be visible in device status in all modes */
|
||||
v->hash_failed = 1;
|
||||
|
||||
if (v->corrupted_errs >= DM_VERITY_MAX_CORRUPTED_ERRS)
|
||||
if (v->corrupted_errs >= DM_VERITY_MAX_CORRUPTED_ERRS) {
|
||||
DMERR("%s: reached maximum errors", v->data_dev->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
v->corrupted_errs++;
|
||||
|
||||
|
|
@ -239,14 +241,16 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
|
|||
DMERR_LIMIT("%s: %s block %llu is corrupted", v->data_dev->name,
|
||||
type_str, block);
|
||||
|
||||
if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS)
|
||||
DMERR("%s: reached maximum errors", v->data_dev->name);
|
||||
|
||||
snprintf(verity_env, DM_VERITY_ENV_LENGTH, "%s=%d,%llu",
|
||||
DM_VERITY_ENV_VAR_NAME, type, block);
|
||||
|
||||
kobject_uevent_env(&disk_to_dev(dm_disk(md))->kobj, KOBJ_CHANGE, envp);
|
||||
|
||||
/* corrupted_errs count had not reached limits */
|
||||
return 0;
|
||||
|
||||
|
||||
out:
|
||||
if (v->mode == DM_VERITY_MODE_LOGGING)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue