DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: Konyukhov Aleksandr <Alexander.Konyukhov@kaspersky.com>,
	Kai Ji <kai.ji@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	Fan Zhang <fanzhang.oss@gmail.com>,
	Declan Doherty <declan.doherty@intel.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, <pkaligineedi@google.com>,
	<roy.fan.zhang@intel.com>
Subject: Re: [PATCH] crypto/ipsec_mb: fix Null ptr dereference in set_mb_job_params()
Date: Mon, 28 Sep 2026 16:04:12 +0100	[thread overview]
Message-ID: <a6f5ac76-0783-4833-a351-a295183483af@intel.com> (raw)
In-Reply-To: <20260925131714.3895601-1-Alexander.Konyukhov@kaspersky.com>


On 25-Sep-26 2:17 PM, Konyukhov Aleksandr wrote:
> In function set_mb_job_params pmd_aesni_mb.c:1742 check
> (cipher_mode == IMB_CIPHER_NULL && oop)
> is not enath to garanteed job->dst != 0, which in turn could lead to
> NULL ptr dereference.
>
> Add new check for (sgl == 0) to be shure that job->dst
> was set in pmd_aesni_mb.c:1610
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 03944ff5e3df ("crypto/ipsec_mb: support null auth/cipher for aesni_mb")
> Cc: roy.fan.zhang@intel.com
>
> Signed-off-by: Konyukhov Aleksandr <Alexander.Konyukhov@kaspersky.com>
> ---
>   drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> index 05dc1a039f..57d8925a87 100644
> --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> @@ -1738,7 +1738,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
>   		job->msg_len_to_cipher_in_bytes = op->sym->cipher.data.length;
>   	}
>   
> -	if (cipher_mode == IMB_CIPHER_NULL && oop) {
> +	if (cipher_mode == IMB_CIPHER_NULL && oop && !sgl) {
>   		memcpy(job->dst + job->cipher_start_src_offset_in_bytes,
>   			job->src + job->cipher_start_src_offset_in_bytes,
>   			job->msg_len_to_cipher_in_bytes);

An error code should be returned here instead of silently fail the 
memcopy / NULL cipher operation.

Something like this below, make sure job->user_data is set

--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -2142,15 +2142,19 @@ set_mb_job_params(IMB_JOB *job, struct 
ipsec_mb_qp *qp,
                 job->msg_len_to_cipher_in_bytes = 
op->sym->cipher.data.length;
         }

-       if (cipher_mode == IMB_CIPHER_NULL && oop) {
-               memcpy(job->dst + job->cipher_start_src_offset_in_bytes,
-                       job->src + job->cipher_start_src_offset_in_bytes,
-                       job->msg_len_to_cipher_in_bytes);
-       }
-
         /* Set user data to be crypto operation data struct */
         job->user_data = op;

+       if (cipher_mode == IMB_CIPHER_NULL && oop) {
+               if (!sgl) {
+                       memcpy(job->dst + 
job->cipher_start_src_offset_in_bytes,
+                               job->src + 
job->cipher_start_src_offset_in_bytes,
+                               job->msg_len_to_cipher_in_bytes);
+                       } else {
+                               return -1;
+                       }
+       }
+
         if (sgl) {

                 if (lb_sgl)


  reply	other threads:[~2026-09-28 15:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 13:17 [PATCH] crypto/ipsec_mb: fix Null ptr dereference in set_mb_job_params() Konyukhov Aleksandr
2026-09-28 15:04 ` Radu Nicolau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-25 11:23 Alexander Konyukhov

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=a6f5ac76-0783-4833-a351-a295183483af@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=Alexander.Konyukhov@kaspersky.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=kai.ji@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=pkaligineedi@google.com \
    --cc=roy.fan.zhang@intel.com \
    --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