From: Ahsan Atta <ahsan.atta@intel.com>
To: herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>,
Ahsan Atta <ahsan.atta@intel.com>,
Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Subject: [PATCH] crypto: qat - avoid double free of authentication descriptor
Date: Wed, 4 Nov 2026 10:23:45 +0000 [thread overview]
Message-ID: <20261104102345.543725-1-ahsan.atta@intel.com> (raw)
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(+)
diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
index a00ca2a0900f..e0ff6b232e91 100644
--- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
@@ -1398,6 +1398,7 @@ static void qat_uclo_ummap_auth_fw(struct icp_qat_fw_loader_handle *handle,
dram_desc.dram_size = ((struct icp_qat_auth_chunk *)
(*desc))->chunk_size;
qat_uclo_simg_free(handle, &dram_desc);
+ *desc = NULL;
}
}
--
2.50.1
reply other threads:[~2026-11-04 10:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261104102345.543725-1-ahsan.atta@intel.com \
--to=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 \
--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