DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	konstantin.ananyev@intel.com, declan.doherty@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] crypto/aesni_mb: fix possible array overrun
Date: Wed, 26 Sep 2018 17:57:22 +0530	[thread overview]
Message-ID: <e86b553a-769e-604c-7544-30b14b5f793f@nxp.com> (raw)
In-Reply-To: <20180802044940.23114-1-pablo.de.lara.guarch@intel.com>



On 8/2/2018 10:19 AM, Pablo de Lara wrote:
> In order to process crypto operations in the AESNI MB PMD,
> they need to be sent to the buffer manager of the Multi-buffer library,
> through the "job" structure.
>
> Currently, it is checked if there are outstanding operations to process
> in the ring, before getting a new job. However, if there are no available
> jobs in the manager, a flush operation needs to take place, freeing some of the jobs,
> so it can be used for the outstanding operation.
>
> In order to avoid leaving the dequeued operation without being processed,
> the maximum number of operations that can be flushed is the remaining operations
> to return, which is the maximum number of operations that can be return minus
> the number of operations ready to be returned (nb_ops - processed_jobs),
> minus 1 (for the new operation).
>
> The problem comes when (nb_ops - processed_jobs) is 1 (last operation to dequeue).
> In that case, flush_mb_mgr is called with maximum number of operations equal to 0,
> which is wrong, causing a potential overrun in the "ops" array.
> Besides, the operation dequeued from the ring will be leaked, as no more operations can
> be returned.
>
> The solution is to first check if there are jobs available in the manager.
> If there are not, flush operation gets called, and if enough operations are returned
> from the manager, then no more outstanding operations get dequeued from the ring,
> avoiding both the memory leak and the array overrun.
> If there are enough jobs, the PMD tries to dequeue an operation from the ring.
> If there are no operations in the ring, the new job pointer is not used,
> and it will be used in the next get_next_job call, so no memory leak happens.
>
> Fixes: 0f548b50a160 ("crypto/aesni_mb: process crypto op on dequeue")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>

Applied to dpdk-next-crypto
Aligned description to 75 characters.

Thanks

      parent reply	other threads:[~2018-09-26 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  4:49 Pablo de Lara
2018-08-27 16:02 ` Ananyev, Konstantin
2018-09-26 12:27 ` Akhil Goyal [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=e86b553a-769e-604c-7544-30b14b5f793f@nxp.com \
    --to=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=pablo.de.lara.guarch@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;
as well as URLs for NNTP newsgroup(s).