DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: check mbuf dyn shared memory validity
@ 2021-04-23  8:11 Min Hu (Connor)
  2021-04-28 12:31 ` Olivier Matz
  0 siblings, 1 reply; 3+ messages in thread
From: Min Hu (Connor) @ 2021-04-23  8:11 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, olivier.matz, thomas

From: Chengwen Feng <fengchengwen@huawei.com>

Because mbuf dyn shared memory was allocated runtime, so it's
necessary to check validity when dump mbuf dyn info.

Also this patch adds an error logging when init shared memory fail.

Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 lib/mbuf/rte_mbuf_dyn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 7d5e942..ca46eb2 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -115,8 +115,10 @@ init_shared_mem(void)
 	} else {
 		mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME);
 	}
-	if (mz == NULL)
+	if (mz == NULL) {
+		RTE_LOG(ERR, MBUF, "Failed to get mbuf dyn shared memory\n");
 		return -1;
+	}
 
 	shm = mz->addr;
 
@@ -525,7 +527,11 @@ void rte_mbuf_dyn_dump(FILE *out)
 	size_t i;
 
 	rte_mcfg_tailq_write_lock();
-	init_shared_mem();
+	if (init_shared_mem() < 0) {
+		rte_mcfg_tailq_write_unlock();
+		return;
+	}
+
 	fprintf(out, "Reserved fields:\n");
 	mbuf_dynfield_list = RTE_TAILQ_CAST(
 		mbuf_dynfield_tailq.head, mbuf_dynfield_list);
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH] mbuf: check mbuf dyn shared memory validity
  2021-04-23  8:11 [dpdk-dev] [PATCH] mbuf: check mbuf dyn shared memory validity Min Hu (Connor)
@ 2021-04-28 12:31 ` Olivier Matz
  2021-05-04 17:50   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2021-04-28 12:31 UTC (permalink / raw)
  To: Min Hu (Connor); +Cc: dev, ferruh.yigit, thomas

Hi Chengwen,

On Fri, Apr 23, 2021 at 04:11:04PM +0800, Min Hu (Connor) wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> Because mbuf dyn shared memory was allocated runtime, so it's
> necessary to check validity when dump mbuf dyn info.
> 
> Also this patch adds an error logging when init shared memory fail.
> 
> Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH] mbuf: check mbuf dyn shared memory validity
  2021-04-28 12:31 ` Olivier Matz
@ 2021-05-04 17:50   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-05-04 17:50 UTC (permalink / raw)
  To: Min Hu (Connor); +Cc: dev, ferruh.yigit, Olivier Matz

28/04/2021 14:31, Olivier Matz:
> Hi Chengwen,
> 
> On Fri, Apr 23, 2021 at 04:11:04PM +0800, Min Hu (Connor) wrote:
> > From: Chengwen Feng <fengchengwen@huawei.com>
> > 
> > Because mbuf dyn shared memory was allocated runtime, so it's
> > necessary to check validity when dump mbuf dyn info.
> > 
> > Also this patch adds an error logging when init shared memory fail.
> > 
> > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

With title "mbuf: check shared memory before dumping dynamic space",
applied, thanks.



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

end of thread, other threads:[~2021-05-04 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23  8:11 [dpdk-dev] [PATCH] mbuf: check mbuf dyn shared memory validity Min Hu (Connor)
2021-04-28 12:31 ` Olivier Matz
2021-05-04 17:50   ` 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).