Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ahsan Atta <ahsan.atta@intel.com>
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
	Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Subject: Re: [PATCH] crypto: qat - avoid double free of authentication descriptor
Date: Fri, 13 Nov 2026 21:09:44 +0800	[thread overview]
Message-ID: <avcMGHZA8PYoQvBi@gondor.apana.org.au> (raw)
In-Reply-To: <20261104102345.543725-1-ahsan.atta@intel.com>

On Wed, Nov 04, 2026 at 10:23:45AM +0000, Ahsan Atta wrote:
> From: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
> 
> qat_uclo_wr_suof_img() reuses a single struct icp_qat_fw_auth_desc
> pointer across all signed images. At the end of every loop iteration
> qat_uclo_ummap_auth_fw() releases the DMA buffer backing the
> descriptor, but leaves the caller's pointer untouched.
> 
> If qat_uclo_map_auth_fw() then fails for a subsequent image before it
> assigns a new descriptor, for example when qat_uclo_simg_alloc()
> cannot allocate the DMA region, the error path jumps to wr_err and
> calls qat_uclo_ummap_auth_fw() again on the stale pointer. This reads
> chunk_bus_addr and chunk_size from already freed coherent memory and
> passes them to dma_free_coherent(), resulting in a use-after-free and
> a double free.
> 
> Clear the descriptor pointer in qat_uclo_ummap_auth_fw() after the
> buffer is released so that it is unmapped at most once.
> 
> Fixes: b0272276d903 ("crypto: qat - add support for new devices to FW loader")
> Signed-off-by: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
> Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> ---
>  drivers/crypto/intel/qat/qat_common/qat_uclo.c | 1 +
>  1 file changed, 1 insertion(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 10:23 [PATCH] crypto: qat - avoid double free of authentication descriptor Ahsan Atta
2026-11-13 13:09 ` Herbert Xu [this message]

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=avcMGHZA8PYoQvBi@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=ahsan.atta@intel.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=svyatoslav.pankratov@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