Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Ahsan Atta <ahsan.atta@intel.com>
Cc: herbert@gondor.apana.org.au, 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 15:45:11 +0100	[thread overview]
Message-ID: <ff20eb2c-4bfe-4960-a642-c9e366a3524e@redhat.com> (raw)
In-Reply-To: <avchnYuwouXKyRgS@soc-PF5467PW.clients.intel.com>

Am 13.11.26 um 15:41 schrieb Ahsan Atta:
> On Fri, Nov 13, 2026 at 12:20:47PM +0100, Thomas Huth wrote:
>> 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.>
> 
> Hi Thomas,
> With this patch adf_dev_init() would still return -EFAULT when
> adf_ae_init() fails.
> 
>          if (adf_ae_init(accel_dev)) {
>                  dev_err(&GET_DEV(accel_dev),
>                          "Failed to initialise Acceleration Engine\n");
>                  return -EFAULT;
>          }
> Let me know if you would like me to add your reviewed by tag.
Yes, sorry, I didn't meant that you should change this patch here, my 
comment was rather meant as a suggestion for another future patch.

  Thomas


  reply	other threads:[~2026-11-13 14:45 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
2026-11-13 14:41   ` Ahsan Atta
2026-11-13 14:45     ` Thomas Huth [this message]
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=ff20eb2c-4bfe-4960-a642-c9e366a3524e@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