From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 8F497C9F8 for ; Sat, 27 Jun 2015 00:14:51 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 26 Jun 2015 15:14:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,687,1427785200"; d="scan'208";a="595535281" Received: from mbernalm-mobl3.amr.corp.intel.com (HELO mbernalm-mobl3.zpn.intel.com) ([10.219.18.109]) by orsmga003.jf.intel.com with ESMTP; 26 Jun 2015 15:14:50 -0700 From: Miguel Bernal Marin To: dev@dpdk.org Date: Fri, 26 Jun 2015 17:14:38 -0500 Message-Id: <1435356878-10304-5-git-send-email-miguel.bernal.marin@linux.intel.com> X-Mailer: git-send-email 2.4.4 In-Reply-To: <1435356878-10304-1-git-send-email-miguel.bernal.marin@linux.intel.com> References: <1435259380-26251-1-git-send-email-miguel.bernal.marin@linux.intel.com> <1435356878-10304-1-git-send-email-miguel.bernal.marin@linux.intel.com> Subject: [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2015 22:14:52 -0000 A missing port from memcpy_toiovecend to copy_to_iter is showed when vHost HDR is enabled. DPDK would not build. This patch add this validation to build with kernel > 3.19. Fixes: 45e63ba8db31 ("kni: fix vhost build with kernels 3.19 and 4.0") Fixes: ba7438aed924 ("vhost: don't bother copying iovecs in handle_rx(), kill memcpy_toiovecend()") Signed-off-by: Miguel Bernal Marin --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index f21b47e..013a677 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -427,10 +427,15 @@ kni_sock_rcvmsg(struct socket *sock, #ifdef RTE_KNI_VHOST_VNET_HDR_EN /* no need to copy hdr when no pkt received */ +#ifdef HAVE_IOV_ITER_MSGHDR + if (unlikely(copy_to_iter((void *)&vnet_hdr, vnet_hdr_len, + &m->msg_iter))) +#else if (unlikely(memcpy_toiovecend(m->msg_iov, (void *)&vnet_hdr, 0, vnet_hdr_len))) +#endif /* HAVE_IOV_ITER_MSGHDR */ return -EFAULT; -#endif +#endif /* RTE_KNI_VHOST_VNET_HDR_EN */ KNI_DBG_RX("kni_rcvmsg expect_len %ld, flags 0x%08x, pkt_len %d\n", (unsigned long)len, q->flags, pkt_len); -- 2.4.4