patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/3] ethdev: fix null pointer checking
@ 2019-04-03 16:07 Mohammad Abdul Awal
  2019-04-03 16:27 ` Thomas Monjalon
  2019-04-03 18:50 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
  0 siblings, 2 replies; 10+ messages in thread
From: Mohammad Abdul Awal @ 2019-04-03 16:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit, arybchenko, Mohammad Abdul Awal, stable

Null value for parameter name will cause segfault for the
strnlen and strcmp functions.

Fixes: 0b33b68d12 ("ethdev: export allocate function")
Fixes: 942661004c ("ethdev: export secondary attach function")
Cc: stable@dpdk.org

Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 10bdfb37e..26898ed08 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -440,6 +440,11 @@ rte_eth_dev_allocate(const char *name)
 	struct rte_eth_dev *eth_dev = NULL;
 	size_t name_len;
 
+	if (name == NULL) {
+		RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
+		return NULL;
+	}
+
 	name_len = strnlen(name, RTE_ETH_NAME_MAX_LEN);
 	if (name_len == 0) {
 		RTE_ETHDEV_LOG(ERR, "Zero length Ethernet device name\n");
@@ -492,6 +497,11 @@ rte_eth_dev_attach_secondary(const char *name)
 	uint16_t i;
 	struct rte_eth_dev *eth_dev = NULL;
 
+	if (name == NULL) {
+		RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
+		return NULL;
+	}
+
 	rte_eth_dev_shared_data_prepare();
 
 	/* Synchronize port attachment to primary port creation and release. */
-- 
2.17.1


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

end of thread, other threads:[~2019-04-04  8:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 16:07 [dpdk-stable] [PATCH 1/3] ethdev: fix null pointer checking Mohammad Abdul Awal
2019-04-03 16:27 ` Thomas Monjalon
2019-04-03 16:35   ` Ferruh Yigit
2019-04-03 16:41     ` [dpdk-stable] [dpdk-dev] " Bruce Richardson
2019-04-03 16:52       ` Ferruh Yigit
2019-04-03 17:32         ` David Marchand
2019-04-04  8:33           ` Mohammad Abdul Awal
2019-04-03 17:30     ` [dpdk-stable] " Awal, Mohammad Abdul
2019-04-03 18:42       ` Thomas Monjalon
2019-04-03 18:50 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger

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