From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 313481B6DF for ; Wed, 11 Apr 2018 12:16:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2018 03:16:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,435,1517904000"; d="scan'208";a="42463495" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga003.jf.intel.com with ESMTP; 11 Apr 2018 03:16:44 -0700 From: Fan Zhang To: dev@dpdk.org Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com, ferruh.yigit@intel.com Date: Wed, 11 Apr 2018 11:09:07 +0100 Message-Id: <20180411100907.39057-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] vhost/crypto: fix desc moving for copy mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2018 10:16:48 -0000 Fixes: cd39f8e4fd2a ("vhost/crypto: add request handler") This patch fixes the descriptor moving for copy mode by adding the missing moving step after destination data parsing. Signed-off-by: Fan Zhang --- lib/librte_vhost/vhost_crypto.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index ab75db0b1..363a034cb 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -694,6 +694,10 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, case RTE_VHOST_CRYPTO_ZERO_COPY_DISABLE: vc_req->wb_desc = desc; vc_req->wb_len = cipher->para.dst_data_len; + if (unlikely(move_desc(head, &desc, vc_req->wb_len) < 0)) { + ret = VIRTIO_CRYPTO_ERR; + goto error_exit; + } break; default: ret = VIRTIO_CRYPTO_BADMSG; @@ -840,6 +844,11 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, op->sym->auth.digest.data = digest_addr; op->sym->auth.digest.phys_addr = rte_pktmbuf_iova_offset(m_dst, digest_offset); + if (unlikely(move_desc(head, &desc, + chain->para.hash_result_len) < 0)) { + ret = VIRTIO_CRYPTO_ERR; + goto error_exit; + } break; default: ret = VIRTIO_CRYPTO_BADMSG; -- 2.13.6