From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by dpdk.org (Postfix) with ESMTP id 8ADDF2B92 for ; Mon, 19 Nov 2018 13:25:48 +0100 (CET) Received: by mail-wm1-f52.google.com with SMTP id k198so4616482wmd.3 for ; Mon, 19 Nov 2018 04:25:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2tFFsiH87TtTco/QBblcJfjpP7wKOoEOu+OJQgphr4o=; b=TB7KNtCJNBpfteFJnq2QK/kcRaTXKnrEesGUa8JQh9tEewZlcXY/0rBdlT2cvI3R2M 3Wfs0U55ZHCC1SeZ3wtJPcyZ5T8r1UQYlnrg9L6eHMY59nCVG74w5PCwOmk5wbLnZlEi hYaesO8Io7H4S7uy415AChd9u7tnaAUKMFbtHk/CvllXbcQwRfdEkWrxcl6IZtpNE4i+ rl52doheLnEnl6mFVF5X82RUW6GUmDXWIRihZf0vDGZwTaQhRgoXggC2oZMNjhtYuJv8 2CNmudERUCGA/ZqzZ5lGoCDDy+6Rz1K62QkFjZluZoOyXRwgdeOyCXCyHLkEoB2cLlLd 6fTA== X-Gm-Message-State: AGRZ1gIQpQgaagez54v0amqSsjVR4A9/eTemkoNJrL1tz1VcdUiLmBwh 0D8C8f2bCFLdvk0Nn50sMCQ= X-Google-Smtp-Source: AJdET5czuxyvzfKKixIfWfCwB9UXFm+51M3/CjE3mn+cd9BMeNwIll021phRPGLLAoKxGQWCMHwD9g== X-Received: by 2002:a1c:3491:: with SMTP id b139-v6mr6440122wma.99.1542630348024; Mon, 19 Nov 2018 04:25:48 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id a18sm11455277wrp.13.2018.11.19.04.25.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Nov 2018 04:25:47 -0800 (PST) From: Luca Boccassi To: Thomas Monjalon Cc: Wisam Jaddo , Gaetan Rivet , dpdk stable Date: Mon, 19 Nov 2018 12:25:20 +0000 Message-Id: <20181119122538.14207-3-bluca@debian.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119122538.14207-1-bluca@debian.org> References: <20181108180111.25873-1-bluca@debian.org> <20181119122538.14207-1-bluca@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'pci: fix parsing of address without function number' has been queued to LTS release 16.11.9 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: , X-List-Received-Date: Mon, 19 Nov 2018 12:25:48 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.9 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/21/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Luca Boccassi --- >>From dbff7219743df71f5a68bbf53fc63b3baf0c282f Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Mon, 12 Nov 2018 00:58:56 +0100 Subject: [PATCH] pci: fix parsing of address without function number [ upstream commit 31f19a9beb8d88b67be6e469404081eb834d199c ] If the last part of the PCI address (function number) is missing, the parsing was successful, assuming function 0. The call to strtoul is not returning an error in such a case, so an explicit check is inserted before. This bug has always been there in older parsing macros: - GET_PCIADDR_FIELD - GET_BLACKLIST_FIELD Fixes: af75078fece3 ("first public release") Reported-by: Wisam Jaddo Signed-off-by: Thomas Monjalon Acked-by: Gaetan Rivet --- lib/librte_eal/common/include/rte_pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 9ce884727..10fa85640 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -248,6 +248,8 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); do { \ unsigned long val; \ char *end; \ + if (*in == '\0') \ + return -EINVAL; \ errno = 0; \ val = strtoul((in), &end, 16); \ if (errno != 0 || end[0] != (dlm) || val > (lim)) \ -- 2.19.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-19 12:15:18.187674722 +0000 +++ 0003-pci-fix-parsing-of-address-without-function-number.patch 2018-11-19 12:15:18.071611433 +0000 @@ -1,8 +1,10 @@ -From 31f19a9beb8d88b67be6e469404081eb834d199c Mon Sep 17 00:00:00 2001 +From dbff7219743df71f5a68bbf53fc63b3baf0c282f Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Mon, 12 Nov 2018 00:58:56 +0100 Subject: [PATCH] pci: fix parsing of address without function number +[ upstream commit 31f19a9beb8d88b67be6e469404081eb834d199c ] + If the last part of the PCI address (function number) is missing, the parsing was successful, assuming function 0. The call to strtoul is not returning an error in such a case, @@ -13,30 +15,27 @@ - GET_BLACKLIST_FIELD Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Reported-by: Wisam Jaddo Signed-off-by: Thomas Monjalon Acked-by: Gaetan Rivet --- - lib/librte_pci/rte_pci.c | 4 ++++ - 1 file changed, 4 insertions(+) + lib/librte_eal/common/include/rte_pci.h | 2 ++ + 1 file changed, 2 insertions(+) -diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c -index 530738dbd..f400178bb 100644 ---- a/lib/librte_pci/rte_pci.c -+++ b/lib/librte_pci/rte_pci.c -@@ -30,6 +30,10 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) - uint8_t *u8 = _u8; - char *end; - -+ /* empty string is an error though strtoul() returns 0 */ -+ if (*in == '\0') -+ return NULL; -+ - errno = 0; - val = strtoul(in, &end, 16); - if (errno != 0 || end[0] != dlm || val > UINT8_MAX) { +diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h +index 9ce884727..10fa85640 100644 +--- a/lib/librte_eal/common/include/rte_pci.h ++++ b/lib/librte_eal/common/include/rte_pci.h +@@ -248,6 +248,8 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); + do { \ + unsigned long val; \ + char *end; \ ++ if (*in == '\0') \ ++ return -EINVAL; \ + errno = 0; \ + val = strtoul((in), &end, 16); \ + if (errno != 0 || end[0] != (dlm) || val > (lim)) \ -- 2.19.1