From: "Ji, Kai" <kai.ji@intel.com>
To: "Power, Ciara" <ciara.power@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH] crypto/qat: fix stack buffer overflow in SGL loop
Date: Fri, 14 Apr 2023 13:22:17 +0000 [thread overview]
Message-ID: <SN6PR11MB340892A4B24CF7059B50F0C781999@SN6PR11MB3408.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230414123131.575412-1-ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Friday, April 14, 2023 1:32 PM
> To: Ji, Kai <kai.ji@intel.com>
> Cc: dev@dpdk.org; Power, Ciara <ciara.power@intel.com>; stable@dpdk.org
> Subject: [PATCH] crypto/qat: fix stack buffer overflow in SGL loop
>
> The cvec pointer was incremented incorrectly in the case where the length
> of remaining_off equals cvec len, and there is no next cvec.
> This led to cvec->iova being invalid memory to access.
>
> Instead, only increment the cvec pointer when we know there is a next cvec
> to point to, by checking the i value, which represents the number of cvecs
> available.
> If i is 0, then no need to increment as the current cvec is the last one.
>
> Fixes: a815a04cea05 ("crypto/qat: support symmetric build op request")
> Cc: kai.ji@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
> drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
> b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
> index 524c291340..092265631b 100644
> --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
> +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
> @@ -682,7 +682,8 @@ enqueue_one_chain_job_gen1(struct qat_sym_session *ctx,
> while (remaining_off >= cvec->len && i >= 1) {
> i--;
> remaining_off -= cvec->len;
> - cvec++;
> + if (i)
> + cvec++;
> }
>
> auth_iova_end = cvec->iova + remaining_off;
> --
> 2.25.1
next prev parent reply other threads:[~2023-04-14 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 12:31 Ciara Power
2023-04-14 13:22 ` Ji, Kai [this message]
2023-05-03 7:30 ` Akhil Goyal
2023-04-14 13:28 ` Dooley, Brian
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=SN6PR11MB340892A4B24CF7059B50F0C781999@SN6PR11MB3408.namprd11.prod.outlook.com \
--to=kai.ji@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).