patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] bus/pci: fix allocation of PCI device path
       [not found] <20181106214901.1392-2-stephen@networkplumber.org>
@ 2018-11-23  0:29 ` Ferruh Yigit
  2018-11-23 10:45   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
  2018-11-23 11:01   ` Maxime Coquelin
  0 siblings, 2 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-11-23  0:29 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, Thomas Monjalon, stable, Stephen Hemminger

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")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/bus/pci/linux/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;
 
 	/* 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.17.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix allocation of PCI device path
  2018-11-23  0:29 ` [dpdk-stable] [PATCH] bus/pci: fix allocation of PCI device path Ferruh Yigit
@ 2018-11-23 10:45   ` Thomas Monjalon
  2018-11-23 10:55     ` Andrew Rybchenko
  2018-11-23 11:01   ` Maxime Coquelin
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2018-11-23 10:45 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, stable, Stephen Hemminger, gaetan.rivet, arybchenko

Please, anyone for a review and a test?

23/11/2018 01:29, Ferruh Yigit:
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  drivers/bus/pci/linux/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;
>  
>  	/* 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));
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix allocation of PCI device path
  2018-11-23 10:45   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
@ 2018-11-23 10:55     ` Andrew Rybchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Rybchenko @ 2018-11-23 10:55 UTC (permalink / raw)
  To: Thomas Monjalon, dev
  Cc: Ferruh Yigit, stable, Stephen Hemminger, gaetan.rivet

On 11/23/18 1:45 PM, Thomas Monjalon wrote:
> Please, anyone for a review and a test?
>
> 23/11/2018 01:29, Ferruh Yigit:
>> 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")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix allocation of PCI device path
  2018-11-23  0:29 ` [dpdk-stable] [PATCH] bus/pci: fix allocation of PCI device path Ferruh Yigit
  2018-11-23 10:45   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
@ 2018-11-23 11:01   ` Maxime Coquelin
  2018-11-25 10:53     ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Coquelin @ 2018-11-23 11:01 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Thomas Monjalon, stable, Stephen Hemminger



On 11/23/18 1:29 AM, Ferruh Yigit wrote:
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>   drivers/bus/pci/linux/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;
>   
>   	/* 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));
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix allocation of PCI device path
  2018-11-23 11:01   ` Maxime Coquelin
@ 2018-11-25 10:53     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-11-25 10:53 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Maxime Coquelin, stable, Stephen Hemminger

23/11/2018 12:01, Maxime Coquelin:
> On 11/23/18 1:29 AM, Ferruh Yigit wrote:
> > 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")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-25 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20181106214901.1392-2-stephen@networkplumber.org>
2018-11-23  0:29 ` [dpdk-stable] [PATCH] bus/pci: fix allocation of PCI device path Ferruh Yigit
2018-11-23 10:45   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2018-11-23 10:55     ` Andrew Rybchenko
2018-11-23 11:01   ` Maxime Coquelin
2018-11-25 10:53     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).