From patchwork Wed Apr 15 17:25:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 68572 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 691C8A0563; Wed, 15 Apr 2020 19:26:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2DEAE1D97C; Wed, 15 Apr 2020 19:26:09 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 06F1E1D96B 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=HHdqx8iRfcN0SJsiXQEyBV0L2uXH0pqIJkiIK3ni2Bs=; b=jVv8ACj8blmEoNX7ymFhiCCA7tV8FiT8z91HyUO/aVbOH2EmLACt51G8IC11xL6063oiBF 0gDB6zEfWCQOmjQ0OLB0aXnOxGqXC7ExyjSnbAu7d+DPipijTp95nI1jFjfjTugPDdCamb kVToLRWsYaOZKF46m6OpD8q7EqYpdnY= 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-26-1pVMlsypMRy4TW9zNRffaw-1; Wed, 15 Apr 2020 13:25:56 -0400 X-MC-Unique: 1pVMlsypMRy4TW9zNRffaw-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 CB38D802681; Wed, 15 Apr 2020 17:25:54 +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 E01FD1001DD8; Wed, 15 Apr 2020 17:25:53 +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:46 -0400 Message-Id: <20200415172547.1421587-3-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 Subject: [dpdk-dev] [PATCH v4 2/3] ip_frag: ensure minimum v6 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" In addition, do a formal parameter check. Signed-off-by: Aaron Conole Acked-by: Lukasz Wojciechowski --- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index 43449970e5..ee984aed82 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -79,6 +79,15 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, uint16_t fragment_offset, frag_size; uint64_t frag_bytes_remaining; + /* + * Formal parameter checking. + */ + if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) || + unlikely(nb_pkts_out == 0) || + unlikely(pool_direct == NULL) || unlikely(pool_indirect == NULL) || + unlikely(mtu_size < 1280)) + return -EINVAL; + /* * Ensure the IP payload length of all fragments (except the * the last fragment) are a multiple of 8 bytes per RFC2460.