DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix crash
@ 2019-06-14 17:19 Ferruh Yigit
  2019-06-16  9:58 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ferruh Yigit @ 2019-06-14 17:19 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger
  Cc: dev, Sunil Kumar Kori, YufengX Mo

Testpmd tries to calculate mbuf size based on "max Rx packet size" and
"max MTU segment number".
When driver set a "nb_mtu_seg_max" to zero, it causes division by zero
segmentation fault in testpmd.

If the PMD set "nb_mtu_seg_max" to zero, testpmd shouldn't try to
calculate the mbuf size.

Fixes: 33f9630fc23d ("app/testpmd: create mbuf based on max supported segments")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Sunil Kumar Kori <skori@marvell.com>
Cc: YufengX Mo <yufengx.mo@intel.com>
---
 app/test-pmd/testpmd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 0f2fffec3..4e958bc44 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1174,7 +1174,8 @@ init_config(void)
 		/* Check for maximum number of segments per MTU. Accordingly
 		 * update the mbuf data size.
 		 */
-		if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX) {
+		if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
+				port->dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
 			data_size = rx_mode.max_rx_pkt_len /
 				port->dev_info.rx_desc_lim.nb_mtu_seg_max;
 
-- 
2.21.0


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix crash
  2019-06-14 17:19 [dpdk-dev] [PATCH] app/testpmd: fix crash Ferruh Yigit
@ 2019-06-16  9:58 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2019-06-16  9:58 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	Sunil Kumar Kori, YufengX Mo

14/06/2019 20:19, Ferruh Yigit:
> Testpmd tries to calculate mbuf size based on "max Rx packet size" and
> "max MTU segment number".
> When driver set a "nb_mtu_seg_max" to zero, it causes division by zero
> segmentation fault in testpmd.
> 
> If the PMD set "nb_mtu_seg_max" to zero, testpmd shouldn't try to
> calculate the mbuf size.
> 
> Fixes: 33f9630fc23d ("app/testpmd: create mbuf based on max supported segments")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks



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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 17:19 [dpdk-dev] [PATCH] app/testpmd: fix crash Ferruh Yigit
2019-06-16  9:58 ` Thomas Monjalon

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox