From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 142BDA0563; Wed, 15 Apr 2020 19:26:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA8D01D973; Wed, 15 Apr 2020 19:26:07 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id A83871D969 for ; Wed, 15 Apr 2020 19:25:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586971557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nLqawsNr2+RG2T0spo6PMWUVgDLcr+wyH4d7FiHfb0g=; b=H4woXcgwH8GaO8hdCvMl2++xheaInM4SB/hpKuhibHbCx1+8F4+hS5NxKmFysm65tyJ8jK 5DWTcvg+GvL14+DRvVeqodn49rj+wEqGR3NnWHU1ffLGQXBHOBDAF5vvigI+PvUnK9TNFl w4T6ZOG7BwMWxrAAkssAjGmu0f0QzmA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-PA93ALi9OMyqZwuohdaG_w-1; Wed, 15 Apr 2020 13:25:55 -0400 X-MC-Unique: PA93ALi9OMyqZwuohdaG_w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B59641005509; Wed, 15 Apr 2020 17:25:53 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-116-136.phx2.redhat.com [10.3.116.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0CCA10027B4; Wed, 15 Apr 2020 17:25:52 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: Konstantin Ananyev , Pavan Nikhilesh , Bruce Richardson , David Marchand , Ferruh Yigit , Anatoly Burakov Date: Wed, 15 Apr 2020 13:25:45 -0400 Message-Id: <20200415172547.1421587-2-aconole@redhat.com> In-Reply-To: <20200415172547.1421587-1-aconole@redhat.com> References: <20200401183917.3620845-1-aconole@redhat.com> <20200415172547.1421587-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v4 1/3] ip_frag: ensure minimum v4 fragmentation length 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Do a formal parameter check of mtu length, as well as checking the the various inputs for validity. If any aren't acceptable, we bail. Signed-off-by: Aaron Conole --- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_fr= ag/rte_ipv4_fragmentation.c index 9e9f986cc5..c36678a6d2 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -76,6 +76,15 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, =09uint16_t fragment_offset, flag_offset, frag_size; =09uint16_t frag_bytes_remaining; =20 +=09/* +=09 * Formal parameter checking. +=09 */ +=09if (unlikely(pkt_in =3D=3D NULL) || unlikely(pkts_out =3D=3D NULL) || +=09 unlikely(nb_pkts_out =3D=3D 0) || +=09 unlikely(pool_direct =3D=3D NULL) || unlikely(pool_indirect =3D=3D = NULL) || +=09 unlikely(mtu_size < 68)) +=09=09return -EINVAL; + =09/* =09 * Ensure the IP payload length of all fragments is aligned to a =09 * multiple of 8 bytes as per RFC791 section 2.3. --=20 2.25.1