Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Ahsan Atta <ahsan.atta@intel.com>, herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Subject: Re: [PATCH] crypto: qat - clear fw_loader pointer on adf_ae_init() failure
Date: Fri, 13 Nov 2026 12:20:47 +0100	[thread overview]
Message-ID: <545910af-9ff4-4fcc-92bb-43a56f88753e@redhat.com> (raw)
In-Reply-To: <20261103100126.534424-1-ahsan.atta@intel.com>

Am 03.11.26 um 11:01 schrieb Ahsan Atta:
> adf_ae_init() stores the newly allocated loader data in
> accel_dev->fw_loader before calling qat_hal_init(), as the latter
> publishes the HAL handle through that pointer. If either
> qat_hal_init() or adf_ae_reset() fails, the error paths free the
> allocation but leave accel_dev->fw_loader pointing at freed memory,
> so the device is left holding a dangling pointer.
> 
> No code path dereferences that stale pointer today. This is therefore
> a robustness improvement with no observable failure behind it, hence
> no Fixes tag.
> 
> Clear accel_dev->fw_loader when the allocation is released, and fold
> the duplicated error handling into a cascading goto chain. Report the
> error returned by the callee rather than a generic -EFAULT;
> adf_dev_init() still maps any failure to -EFAULT, so this is a
> readability improvement and not a functional change.

The -EFAULT in adf_dev_init() should likely also go away: EFAULT means "Bad 
address", i.e. a page could not be accessed. Thus it's likely the wrong 
error code for most cases there.>
> Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> ---
>   .../intel/qat/qat_common/adf_accel_engine.c   | 21 ++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
Anyway, this patch is already a proper step into the right direction, so:

Reviewed-by: Thomas Huth <thuth@redhat.com>


  reply	other threads:[~2026-11-13 11:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:01 [PATCH] crypto: qat - clear fw_loader pointer on adf_ae_init() failure Ahsan Atta
2026-11-13 11:20 ` Thomas Huth [this message]
2026-11-13 14:41   ` Ahsan Atta
2026-11-13 14:45     ` Thomas Huth
2026-11-13 12:30 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545910af-9ff4-4fcc-92bb-43a56f88753e@redhat.com \
    --to=thuth@redhat.com \
    --cc=ahsan.atta@intel.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox