[dpdk-stable] patch 'net/af_packet: fix check of file descriptors' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:53 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/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 4dece22a2bd4e3301faa6555e6bf291c011ce3b4 Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Mon, 6 Jul 2020 20:27:32 +0800
Subject: [PATCH] net/af_packet: fix check of file descriptors

[ upstream commit c6d1a552a8798df02bf85627c5d47a28ccdc62f8 ]

Zero is a valid fd. It will fail to check the fd if the fd is zero.

Fixes: 527740ccfaec ("af_packet: fix some leaks")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f5806bf42..6c6bbaccf 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -604,6 +604,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	for (q = 0; q < nb_queues; q++) {
 		(*internals)->rx_queue[q].map = MAP_FAILED;
 		(*internals)->tx_queue[q].map = MAP_FAILED;
+		(*internals)->rx_queue[q].sockfd = -1;
+		(*internals)->tx_queue[q].sockfd = -1;
 	}
 
 	req = &((*internals)->req);
@@ -807,7 +809,7 @@ error:
 
 		rte_free((*internals)->rx_queue[q].rd);
 		rte_free((*internals)->tx_queue[q].rd);
-		if (((*internals)->rx_queue[q].sockfd != 0) &&
+		if (((*internals)->rx_queue[q].sockfd >= 0) &&
 			((*internals)->rx_queue[q].sockfd != qsockfd))
 			close((*internals)->rx_queue[q].sockfd);
 	}
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:54.537386172 +0100
+++ 0155-net-af_packet-fix-check-of-file-descriptors.patch	2020-07-24 12:53:48.519010782 +0100
@@ -1,12 +1,13 @@
-From c6d1a552a8798df02bf85627c5d47a28ccdc62f8 Mon Sep 17 00:00:00 2001
+From 4dece22a2bd4e3301faa6555e6bf291c011ce3b4 Mon Sep 17 00:00:00 2001
 From: Yunjian Wang <wangyunjian at huawei.com>
 Date: Mon, 6 Jul 2020 20:27:32 +0800
 Subject: [PATCH] net/af_packet: fix check of file descriptors
 
+[ upstream commit c6d1a552a8798df02bf85627c5d47a28ccdc62f8 ]
+
 Zero is a valid fd. It will fail to check the fd if the fd is zero.
 
 Fixes: 527740ccfaec ("af_packet: fix some leaks")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
@@ -15,10 +16,10 @@
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
-index e1e7f3973..db5de8e45 100644
+index f5806bf42..6c6bbaccf 100644
 --- a/drivers/net/af_packet/rte_eth_af_packet.c
 +++ b/drivers/net/af_packet/rte_eth_af_packet.c
-@@ -645,6 +645,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
+@@ -604,6 +604,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
  	for (q = 0; q < nb_queues; q++) {
  		(*internals)->rx_queue[q].map = MAP_FAILED;
  		(*internals)->tx_queue[q].map = MAP_FAILED;
@@ -27,7 +28,7 @@
  	}
  
  	req = &((*internals)->req);
-@@ -848,7 +850,7 @@ error:
+@@ -807,7 +809,7 @@ error:
  
  		rte_free((*internals)->rx_queue[q].rd);
  		rte_free((*internals)->tx_queue[q].rd);


More information about the stable mailing list