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 7081CA04DD for ; Wed, 18 Nov 2020 17:37:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE6E5C90A; Wed, 18 Nov 2020 17:37:23 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id E350CC8DA for ; Wed, 18 Nov 2020 17:37:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717439; 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=Gvb2+t5jMHWSq1HXhWfq2vMjm+LCFvr452jvH8IBC8M=; b=IIhDXLyVsDdJhQNCs9ZwFRSnT/WIumd+4+iPQ26UJ5N8j7IWeJUmW6JyTHANPHzZbcoCt6 +VSDsyJRINthy6FBdVChIl4KigbDqE3mQ5RRYFWRYL+3fbnFpQJ0mgn0opT48IPM7h94+f NakF9jGOWavNCmRji4k4OIslQ3ZDLDY= 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-257-JnODNBeXPM21e0Lqcq23ag-1; Wed, 18 Nov 2020 11:37:15 -0500 X-MC-Unique: JnODNBeXPM21e0Lqcq23ag-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D44FB1876553; Wed, 18 Nov 2020 16:36:40 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9A445C643; Wed, 18 Nov 2020 16:36:39 +0000 (UTC) From: Kevin Traynor To: Kevin Laatz Cc: Ferruh Yigit , dpdk stable Date: Wed, 18 Nov 2020 16:34:59 +0000 Message-Id: <20201118163558.1101823-13-ktraynor@redhat.com> In-Reply-To: <20201118163558.1101823-1-ktraynor@redhat.com> References: <20201118163558.1101823-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'net/ring: check internal arguments' has been queued to LTS release 18.11.11 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/cb44dd60e03785d22d3b08a6af740d3888d6f404 Thanks. Kevin. --- >From cb44dd60e03785d22d3b08a6af740d3888d6f404 Mon Sep 17 00:00:00 2001 From: Kevin Laatz Date: Tue, 13 Oct 2020 14:07:04 +0100 Subject: [PATCH] net/ring: check internal arguments [ upstream commit e37bbe212d48a7375a6239478a114829d05692b5 ] Add a check for the return value of the sscanf call in parse_internal_args(), returning an error if we don't get the expected result. Coverity issue: 362049 Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API") Signed-off-by: Kevin Laatz Reviewed-by: Ferruh Yigit --- drivers/net/ring/rte_eth_ring.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 7298ee93e2..245029c107 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -17,4 +17,5 @@ #define ETH_RING_ACTION_ATTACH "ATTACH" #define ETH_RING_INTERNAL_ARG "internal" +#define ETH_RING_INTERNAL_ARG_MAX_LEN 19 /* "0x..16chars..\0" */ static const char *valid_arguments[] = { @@ -542,6 +543,19 @@ parse_internal_args(const char *key __rte_unused, const char *value, struct ring_internal_args **internal_args = data; void *args; + int ret, n; - sscanf(value, "%p", &args); + /* make sure 'value' is valid pointer length */ + if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >= + ETH_RING_INTERNAL_ARG_MAX_LEN) { + PMD_LOG(ERR, "Error parsing internal args, argument is too long"); + return -1; + } + + ret = sscanf(value, "%p%n", &args, &n); + if (ret == 0 || (size_t)n != strlen(value)) { + PMD_LOG(ERR, "Error parsing internal args"); + + return -1; + } *internal_args = args; -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:38.229371101 +0000 +++ 0013-net-ring-check-internal-arguments.patch 2020-11-18 16:33:37.915215053 +0000 @@ -1 +1 @@ -From e37bbe212d48a7375a6239478a114829d05692b5 Mon Sep 17 00:00:00 2001 +From cb44dd60e03785d22d3b08a6af740d3888d6f404 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e37bbe212d48a7375a6239478a114829d05692b5 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 83c5502123..22c0802688 100644 +index 7298ee93e2..245029c107 100644 @@ -30 +31 @@ -@@ -572,6 +573,19 @@ parse_internal_args(const char *key __rte_unused, const char *value, +@@ -542,6 +543,19 @@ parse_internal_args(const char *key __rte_unused, const char *value,