[PATCH] crypto/qat: fix docsis segmentation fault
Troy, Rebecca
rebecca.troy at intel.com
Tue Jun 28 12:32:25 CEST 2022
> On Mon, Jun 27, 2022 at 6:45 PM Rebecca Troy <rebecca.troy at intel.com>
> wrote:
> >
> > Currently if AES or DES algorithms fail for Docsis test suite, a
> > segmentation fault occurs when cryptodev_qat_autotest is ran.
> >
> > This is due to a duplicate call of EVP_CIPHER_CTX_free for the session
> > context. Ctx is freed firstly in the bpi_cipher_ctx_init function and
> > then again at the end of qat_sym_session_configure_cipher function.
> >
> > This commit fixes this bug by removing the first instance of
> > EVP_CIPHER_CTX_free, leaving just the dedicated function in the upper
> > level to free the ctx.
>
> This is awkward.
> This helper should let *ctx alone until everything succeeded.
>
> --
> David Marchand
Hi David,
This bug was found under unusual circumstances. Unit tests failed due to no legacy algorithm support on the system, which caused a segmentation fault rather than the expected 'Tests failed' result.
When these unit tests fail, the current error handling directs that the *ctx be freed twice - once prematurely (which is the instance this patch is removing) and then again after the tests have registered as failed, causing the segmentation fault. I agree that the *ctx shouldn't have been freed prematurely, so this patch fixes the incorrect error handling here by removing that first instance of *ctx freeing.
Hope this clears things up.
Rebecca Troy.
More information about the dev
mailing list