patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails
@ 2016-09-09  8:16 Olivier Matz
  2016-09-09  8:25 ` Yuanhan Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Olivier Matz @ 2016-09-09  8:16 UTC (permalink / raw)
  To: dev, pablo.de.lara.guarch; +Cc: stable

Avoid access to mempool pointer if it is NULL.

Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
Coverity issue: 127553

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/testpmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1428974..e0f8285 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 				mb_size, (unsigned) mb_mempool_cache,
 				sizeof(struct rte_pktmbuf_pool_private),
 				socket_id, 0);
+			if (rte_mp == NULL)
+				goto err;
 
 			if (rte_mempool_populate_anon(rte_mp) == 0) {
 				rte_mempool_free(rte_mp);
 				rte_mp = NULL;
+				goto err;
 			}
 			rte_pktmbuf_pool_init(rte_mp, NULL);
 			rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
@@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		}
 	}
 
+ err:
 	if (rte_mp == NULL) {
 		rte_exit(EXIT_FAILURE,
 			"Creation of mbuf pool for socket %u failed: %s\n",
-- 
2.8.1

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

* Re: [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails
  2016-09-09  8:16 [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails Olivier Matz
@ 2016-09-09  8:25 ` Yuanhan Liu
  2016-09-09  8:43   ` Olivier Matz
  2016-09-09  9:40 ` [dpdk-stable] [PATCH v2] " Olivier Matz
  2016-09-09  9:42 ` [dpdk-stable] [PATCH v3] " Olivier Matz
  2 siblings, 1 reply; 8+ messages in thread
From: Yuanhan Liu @ 2016-09-09  8:25 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, pablo.de.lara.guarch, stable

On Fri, Sep 09, 2016 at 10:16:25AM +0200, Olivier Matz wrote:
> Avoid access to mempool pointer if it is NULL.
> 
> Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
> Coverity issue: 127553
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
>  app/test-pmd/testpmd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 1428974..e0f8285 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
>  				mb_size, (unsigned) mb_mempool_cache,
>  				sizeof(struct rte_pktmbuf_pool_private),
>  				socket_id, 0);
> +			if (rte_mp == NULL)
> +				goto err;
>  
>  			if (rte_mempool_populate_anon(rte_mp) == 0) {
>  				rte_mempool_free(rte_mp);
>  				rte_mp = NULL;
> +				goto err;
>  			}
>  			rte_pktmbuf_pool_init(rte_mp, NULL);
>  			rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
> @@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
>  		}
>  	}
>  
> + err:

A minor nit: there is a heading white space char.

	--yliu

>  	if (rte_mp == NULL) {
>  		rte_exit(EXIT_FAILURE,
>  			"Creation of mbuf pool for socket %u failed: %s\n",
> -- 
> 2.8.1

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

* Re: [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails
  2016-09-09  8:25 ` Yuanhan Liu
@ 2016-09-09  8:43   ` Olivier Matz
  0 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-09-09  8:43 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev, pablo.de.lara.guarch, stable

Hi Yuanhan,

On 09/09/2016 10:25 AM, Yuanhan Liu wrote:
> On Fri, Sep 09, 2016 at 10:16:25AM +0200, Olivier Matz wrote:
>> Avoid access to mempool pointer if it is NULL.
>>
>> Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
>> Coverity issue: 127553
>>
>> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
>> ---
>>  app/test-pmd/testpmd.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 1428974..e0f8285 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
>>  				mb_size, (unsigned) mb_mempool_cache,
>>  				sizeof(struct rte_pktmbuf_pool_private),
>>  				socket_id, 0);
>> +			if (rte_mp == NULL)
>> +				goto err;
>>  
>>  			if (rte_mempool_populate_anon(rte_mp) == 0) {
>>  				rte_mempool_free(rte_mp);
>>  				rte_mp = NULL;
>> +				goto err;
>>  			}
>>  			rte_pktmbuf_pool_init(rte_mp, NULL);
>>  			rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
>> @@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
>>  		}
>>  	}
>>  
>> + err:
> 
> A minor nit: there is a heading white space char.
> 

Well, that's something I've been doing since a long time due to my
editor config, but I cannot find any good reason for doing that.

I'll send a v2 without this space (and fix my config for next times ;))

Olivier

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

* [dpdk-stable] [PATCH v2] testpmd: fix crash when mempool allocation fails
  2016-09-09  8:16 [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails Olivier Matz
  2016-09-09  8:25 ` Yuanhan Liu
@ 2016-09-09  9:40 ` Olivier Matz
  2016-09-09  9:42 ` [dpdk-stable] [PATCH v3] " Olivier Matz
  2 siblings, 0 replies; 8+ messages in thread
From: Olivier Matz @ 2016-09-09  9:40 UTC (permalink / raw)
  To: dev, pablo.de.lara.guarch; +Cc: stable

Avoid access to mempool pointer if it is NULL.

Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
Coverity issue: 127553

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/testpmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1428974..e0f8285 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 				mb_size, (unsigned) mb_mempool_cache,
 				sizeof(struct rte_pktmbuf_pool_private),
 				socket_id, 0);
+			if (rte_mp == NULL)
+				goto err;
 
 			if (rte_mempool_populate_anon(rte_mp) == 0) {
 				rte_mempool_free(rte_mp);
 				rte_mp = NULL;
+				goto err;
 			}
 			rte_pktmbuf_pool_init(rte_mp, NULL);
 			rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
@@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		}
 	}
 
+ err:
 	if (rte_mp == NULL) {
 		rte_exit(EXIT_FAILURE,
 			"Creation of mbuf pool for socket %u failed: %s\n",
-- 
2.8.1

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

* [dpdk-stable] [PATCH v3] testpmd: fix crash when mempool allocation fails
  2016-09-09  8:16 [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails Olivier Matz
  2016-09-09  8:25 ` Yuanhan Liu
  2016-09-09  9:40 ` [dpdk-stable] [PATCH v2] " Olivier Matz
@ 2016-09-09  9:42 ` Olivier Matz
  2016-09-21 23:02   ` De Lara Guarch, Pablo
  2016-09-27  6:37   ` Yuanhan Liu
  2 siblings, 2 replies; 8+ messages in thread
From: Olivier Matz @ 2016-09-09  9:42 UTC (permalink / raw)
  To: dev, pablo.de.lara.guarch; +Cc: stable

Avoid access to mempool pointer if it is NULL.

Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
Coverity issue: 127553

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/testpmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1428974..e5f5986 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 				mb_size, (unsigned) mb_mempool_cache,
 				sizeof(struct rte_pktmbuf_pool_private),
 				socket_id, 0);
+			if (rte_mp == NULL)
+				goto err;
 
 			if (rte_mempool_populate_anon(rte_mp) == 0) {
 				rte_mempool_free(rte_mp);
 				rte_mp = NULL;
+				goto err;
 			}
 			rte_pktmbuf_pool_init(rte_mp, NULL);
 			rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
@@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		}
 	}
 
+err:
 	if (rte_mp == NULL) {
 		rte_exit(EXIT_FAILURE,
 			"Creation of mbuf pool for socket %u failed: %s\n",
-- 
2.8.1

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

* Re: [dpdk-stable] [PATCH v3] testpmd: fix crash when mempool allocation fails
  2016-09-09  9:42 ` [dpdk-stable] [PATCH v3] " Olivier Matz
@ 2016-09-21 23:02   ` De Lara Guarch, Pablo
  2016-09-23 18:17     ` Thomas Monjalon
  2016-09-27  6:37   ` Yuanhan Liu
  1 sibling, 1 reply; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2016-09-21 23:02 UTC (permalink / raw)
  To: Olivier Matz, dev; +Cc: stable



> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, September 09, 2016 2:42 AM
> To: dev@dpdk.org; De Lara Guarch, Pablo
> Cc: stable@dpdk.org
> Subject: [PATCH v3] testpmd: fix crash when mempool allocation fails
> 
> Avoid access to mempool pointer if it is NULL.
> 
> Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
> Coverity issue: 127553
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* Re: [dpdk-stable] [PATCH v3] testpmd: fix crash when mempool allocation fails
  2016-09-21 23:02   ` De Lara Guarch, Pablo
@ 2016-09-23 18:17     ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2016-09-23 18:17 UTC (permalink / raw)
  To: Olivier Matz; +Cc: stable, De Lara Guarch, Pablo, dev

> > Avoid access to mempool pointer if it is NULL.
> > 
> > Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
> > Coverity issue: 127553
> > 
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

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

* Re: [dpdk-stable] [PATCH v3] testpmd: fix crash when mempool allocation fails
  2016-09-09  9:42 ` [dpdk-stable] [PATCH v3] " Olivier Matz
  2016-09-21 23:02   ` De Lara Guarch, Pablo
@ 2016-09-27  6:37   ` Yuanhan Liu
  1 sibling, 0 replies; 8+ messages in thread
From: Yuanhan Liu @ 2016-09-27  6:37 UTC (permalink / raw)
  To: Olivier Matz; +Cc: pablo.de.lara.guarch, stable

On Fri, Sep 09, 2016 at 11:42:08AM +0200, Olivier Matz wrote:
> Avoid access to mempool pointer if it is NULL.
> 
> Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")
> Coverity issue: 127553
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

FYI, this patch has been applied to stable branch v16.07.

It hasn't been pushed to http://dpdk.org/browse/dpdk-stable/ yet.
It will be pushed if I get no objections in around TWO days. So 
please shutout if you have objections.

Thanks.

	--yliu

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

end of thread, other threads:[~2016-09-27  6:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09  8:16 [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails Olivier Matz
2016-09-09  8:25 ` Yuanhan Liu
2016-09-09  8:43   ` Olivier Matz
2016-09-09  9:40 ` [dpdk-stable] [PATCH v2] " Olivier Matz
2016-09-09  9:42 ` [dpdk-stable] [PATCH v3] " Olivier Matz
2016-09-21 23:02   ` De Lara Guarch, Pablo
2016-09-23 18:17     ` Thomas Monjalon
2016-09-27  6:37   ` Yuanhan Liu

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).