From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0121242653 for ; Wed, 27 Sep 2023 14:40:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED8284067A; Wed, 27 Sep 2023 14:40:43 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4BD194028C; Wed, 27 Sep 2023 14:40:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695818441; x=1727354441; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qODniF95lM4FBhZusJH8hy99d+EKKtjvdfEOUCtPEbc=; b=Cl82l6SxzgurZ7R8tPouvW/YyotVquS0O4xKopc/jG+h3S1mPCIXDTAB ivr46XTe8fCdZOJfsxf95gXELw/i+vDHBmaw64hvTuf8VslVkl4xsvig2 X/cjgCMgOgrlIg7+3qwV8Iw5C8rCFitkXvezkrA3/kz7wJi1z2F68kQ4v dWiMq2y+yPsLItfHMR3cnY0XU31V+QHsWwywStIicdMbVZLW5TkY+LG1l PNiIXGfO1Covf1gRtFoh6wp380ZjwQGeiUbXzJUHFPbN/uc7WLrEYXifZ 4ymzrXhWhYQ2NshitSLrYzghjw/3VWJfCnya15ym/srdbcoRjTeNH5LIV w==; X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="385671631" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="385671631" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 05:40:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="892585617" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="892585617" Received: from kkaras2.igk.intel.com ([10.211.11.138]) by fmsmga001.fm.intel.com with ESMTP; 27 Sep 2023 05:39:30 -0700 From: Krzysztof Karas To: Kai Ji , Pablo de Lara , Marcel Cornu , Ciara Power Cc: dev@dpdk.org, Krzysztof Karas , stable@dpdk.org Subject: [PATCH] crypto/ipsec_mb: Do not dequeue ops from ring after job flush. Date: Wed, 27 Sep 2023 14:40:34 +0200 Message-Id: <20230927124034.1092086-1-krzysztof.karas@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Previously it was possible to increment `processed_jobs` to a value greater than requested `nb_ops`, because after flushing at most `nb_ops` jobs the while loop continued, so `processed_jobs` could still be incremented and it was possible for this variable to be greater than `nb_ops`. If `ops` provided to the function were only `nb_ops` long, then the `aesni_mb_dequeue_burst()` would write to the memory outside of `ops` array. Fixes: b50b8b5b38f8 ("crypto/ipsec_mb: use burst API in AESNI") Cc: stable@dpdk.org Signed-off-by: Krzysztof Karas --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 9e298023d7..ff52bc85a4 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -2056,7 +2056,7 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, uint16_t n = (nb_ops / burst_sz) ? burst_sz : nb_ops; - while (unlikely((IMB_GET_NEXT_BURST(mb_mgr, n, jobs)) < n)) { + if (unlikely((IMB_GET_NEXT_BURST(mb_mgr, n, jobs)) < n)) { /* * Not enough free jobs in the queue * Flush n jobs until enough jobs available @@ -2074,6 +2074,8 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, break; } } + nb_ops -= nb_jobs; + continue; } /* -- 2.34.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.