> When erasing a keyslot we deliberately ignore some errors and
> carry on trying to erase as much as possible. This results in
> overwriting Error objects and triggering an assertion. Don't
> pass in the &local_err, if errp is already set.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/4697
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> Message-ID: <[email protected]>
> ---
>  crypto/block-luks.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> index 0926ad28f0cd..277a51106072 100644
> --- a/crypto/block-luks.c
> +++ b/crypto/block-luks.c
> @@ -1152,6 +1152,7 @@ qcrypto_block_luks_erase_key(QCryptoBlock *block,
>  
>      if (ret < 0) {
>          error_propagate(errp, local_err);
> +        local_err = NULL;
>      }
>      /*
>       * Now try to erase the key material, even if the header
> @@ -1169,6 +1170,7 @@ qcrypto_block_luks_erase_key(QCryptoBlock *block,
>              if (i > 0) {
>                  return -1;
>              }
> +            local_err = NULL;

This is the recoverable path: the comment says we still write zeros and
carry on, so a first-iteration random failure is not meant to be fatal. But
error_propagate(errp, local_err) has just stored that error in *errp.

Keep the first-iteration failure as non-fatal but do not hand it to errp?
(e.g. error_free(local_err) instead of error_propagate() when i == 0)

-- 
Marc-André Lureau <[email protected]>


Reply via email to