[dpdk-stable] patch 'net/pcap: fix crash on exit for infinite Rx' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:45:34 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/30/20. 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. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 8d628c33c4e016f5f06c0550448d4c7bae9209af Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit at intel.com>
Date: Fri, 9 Oct 2020 16:50:39 +0100
Subject: [PATCH] net/pcap: fix crash on exit for infinite Rx

[ upstream commit fbedd8ca9e6807df022af8fde9b1d6d2c87fda6d ]

If the infinite Rx argument ('infinite_rx') is provided a ring is
allocated and filled in the '.rx_queue_setup' dev_ops.
Later this ring freed in the '.dev_close' dev_ops.

If the 'infinite_rx' provided and '.dev_close' called before
'.rx_queue_setup', the ring will be NULL and trying to empty/free it
will cause a crash.

This is fixed by adding ring NULL check before trying to empty/free it.

Bugzilla ID: 548
Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")

Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/pcap/rte_eth_pcap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 6fb26c8c9d..fbff559c0a 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -735,6 +735,13 @@ eth_dev_close(struct rte_eth_dev *dev)
 			struct pcap_rx_queue *pcap_q = &internals->rx_queue[i];
 			struct rte_mbuf *pcap_buf;
 
+			/*
+			 * 'pcap_q->pkts' can be NULL if 'eth_dev_close()'
+			 * called before 'eth_rx_queue_setup()' has been called
+			 */
+			if (pcap_q->pkts == NULL)
+				continue;
+
 			while (!rte_ring_dequeue(pcap_q->pkts,
 					(void **)&pcap_buf))
 				rte_pktmbuf_free(pcap_buf);
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:17.152151375 +0000
+++ 0175-net-pcap-fix-crash-on-exit-for-infinite-Rx.patch	2020-10-28 10:35:11.784834145 +0000
@@ -1,8 +1,10 @@
-From fbedd8ca9e6807df022af8fde9b1d6d2c87fda6d Mon Sep 17 00:00:00 2001
+From 8d628c33c4e016f5f06c0550448d4c7bae9209af Mon Sep 17 00:00:00 2001
 From: Ferruh Yigit <ferruh.yigit at intel.com>
 Date: Fri, 9 Oct 2020 16:50:39 +0100
 Subject: [PATCH] net/pcap: fix crash on exit for infinite Rx
 
+[ upstream commit fbedd8ca9e6807df022af8fde9b1d6d2c87fda6d ]
+
 If the infinite Rx argument ('infinite_rx') is provided a ring is
 allocated and filled in the '.rx_queue_setup' dev_ops.
 Later this ring freed in the '.dev_close' dev_ops.
@@ -15,7 +17,6 @@
 
 Bugzilla ID: 548
 Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
 ---
@@ -23,10 +24,10 @@
  1 file changed, 7 insertions(+)
 
 diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
-index 057aa9dbfc..49764c0ee6 100644
+index 6fb26c8c9d..fbff559c0a 100644
 --- a/drivers/net/pcap/rte_eth_pcap.c
 +++ b/drivers/net/pcap/rte_eth_pcap.c
-@@ -748,6 +748,13 @@ eth_dev_close(struct rte_eth_dev *dev)
+@@ -735,6 +735,13 @@ eth_dev_close(struct rte_eth_dev *dev)
  			struct pcap_rx_queue *pcap_q = &internals->rx_queue[i];
  			struct rte_mbuf *pcap_buf;
  


More information about the stable mailing list