From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 50F781B6CF for ; Mon, 26 Nov 2018 13:49:31 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id q18so18762568wrx.9 for ; Mon, 26 Nov 2018 04:49:31 -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=qvm0mXG+HMNenx4hZMfEcL3IBJ5dPnjNbxhTE/WFCZ4=; b=YysZmHlBoTSpT+Weab3dXyQ+84BMj4MEZUuCraovIQ6VA0FClWcW3KgokHoYJbktKF CpGei7ETjGMskNbbOinegL9sgsA1pLTf6g/t3fONZTJAiAaiwUHD1Skg+pmDXAjahvDF 2XR0dz4DlDeJNPGWDV+4oWd0dbKQNiDw5lLL07cdKO8DpGMX6/1oEH3vb2Qxe0jcqIhN 4Se7EYJKZZHX0stbDG5L6auiVRgcNSHXbIxl3JZrzyfTHx3RRKVPYQO++deOMWqm36Lz cldCjKuHKvwp7jMGPjPGulV8raArO70xjaCU2mentTJfRSrTDUUWXbsTQGFYy5wWAcY3 l9zg== X-Gm-Message-State: AA+aEWbzqLAQEkuXHtktgjXUr4RcCx9vrizpJRXFbHQReUtbGWoWZfYs Jua2jq6SquJG+yIKuSx6Zkw= X-Google-Smtp-Source: AFSGD/Xfz5wPbKdOBrKZUD3nrVWfMcX2WoSS0+emH6lG256rqsnOIbpALh7ggCsuQhEAIy0QaNTVqg== X-Received: by 2002:a5d:684b:: with SMTP id o11mr22364268wrw.316.1543236570904; Mon, 26 Nov 2018 04:49:30 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id d2sm141803wro.88.2018.11.26.04.49.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 04:49:29 -0800 (PST) From: Luca Boccassi To: Ferruh Yigit Cc: Stephen Hemminger , Andrew Rybchenko , Maxime Coquelin , dpdk stable Date: Mon, 26 Nov 2018 12:49:16 +0000 Message-Id: <20181126124916.16240-5-bluca@debian.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126124916.16240-1-bluca@debian.org> References: <20181119122538.14207-1-bluca@debian.org> <20181126124916.16240-1-bluca@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'bus/pci: fix allocation of device path' 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, 26 Nov 2018 12:49:31 -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/28/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 ab3e3cc4c18ddf98842dae15bf23d14febe8447a Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Fri, 23 Nov 2018 00:29:45 +0000 Subject: [PATCH] bus/pci: fix allocation of device path [ upstream commit d3110b124af64199b0901223c7e0117f7480480f ] The pci_resource_by_index called strlen() on uninitialized memory which would lead to the wrong size of memory allocated for the path portion of the resource map. This would either cause excessively large allocation, or worse memory corruption. Coverity issue: 300868 Fixes: ea9d56226e72 ("pci: introduce function to map uio resource by index") Signed-off-by: Stephen Hemminger Signed-off-by: Ferruh Yigit Reviewed-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index 42280678f..3ca217f49 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -327,7 +327,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, loc->function, res_idx); /* allocate memory to keep path */ - maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0); + maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0); if (maps[map_idx].path == NULL) { RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n", strerror(errno)); -- 2.19.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-26 12:45:13.711098953 +0000 +++ 0005-bus-pci-fix-allocation-of-device-path.patch 2018-11-26 12:45:13.611202330 +0000 @@ -1,8 +1,10 @@ -From d3110b124af64199b0901223c7e0117f7480480f Mon Sep 17 00:00:00 2001 +From ab3e3cc4c18ddf98842dae15bf23d14febe8447a Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Fri, 23 Nov 2018 00:29:45 +0000 Subject: [PATCH] bus/pci: fix allocation of device path +[ upstream commit d3110b124af64199b0901223c7e0117f7480480f ] + The pci_resource_by_index called strlen() on uninitialized memory which would lead to the wrong size of memory allocated for the path portion of the resource map. This would either cause @@ -10,22 +12,21 @@ Coverity issue: 300868 Fixes: ea9d56226e72 ("pci: introduce function to map uio resource by index") -Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Signed-off-by: Ferruh Yigit Reviewed-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- - drivers/bus/pci/linux/pci_uio.c | 2 +- + lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c -index a7c14421a..09ecbb7aa 100644 ---- a/drivers/bus/pci/linux/pci_uio.c -+++ b/drivers/bus/pci/linux/pci_uio.c -@@ -296,7 +296,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, - maps = uio_res->maps; +diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +index 42280678f..3ca217f49 100644 +--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c ++++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +@@ -327,7 +327,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, + loc->function, res_idx); /* allocate memory to keep path */ - maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);