On Tue, Oct 27, 2026 at 06:27:34PM +0400, [email protected] wrote: > > 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)
>From the POV of the caller, we always want to report an error back to them. We just want to try todo as much erasing as possible, even when we're reporting an error. So don't think of this as a recover from error sucess path. It is still a fatal error overall. With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
