DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: add parameter check for RSS flow init
@ 2018-11-12  9:25 Wei Zhao
       [not found] ` <A2573D2ACFCADC41BB3BE09C6DE313CA07E6BBDD@PGSMSX103.gar.corp.intel.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wei Zhao @ 2018-11-12  9:25 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, stable, yuan.peng, Wei Zhao

There need an parameter check for RSS flow init, or it may cause
core dump if pointer is NULL in memory copy.

Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1c77906..217a8dc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12552,13 +12552,16 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
 	if (in->key_len > RTE_DIM(out->key) ||
 	    in->queue_num > RTE_DIM(out->queue))
 		return -EINVAL;
+	if (!in->key && in->key_len)
+		return -EINVAL;
+	if (out->key && in->key)
+		out->conf.key = memcpy(out->key, in->key, in->key_len);
 	out->conf = (struct rte_flow_action_rss){
 		.func = in->func,
 		.level = in->level,
 		.types = in->types,
 		.key_len = in->key_len,
 		.queue_num = in->queue_num,
-		.key = memcpy(out->key, in->key, in->key_len),
 		.queue = memcpy(out->queue, in->queue,
 				sizeof(*in->queue) * in->queue_num),
 	};
-- 
2.7.5

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

end of thread, other threads:[~2018-11-14  4:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12  9:25 [dpdk-dev] [PATCH] net/i40e: add parameter check for RSS flow init Wei Zhao
     [not found] ` <A2573D2ACFCADC41BB3BE09C6DE313CA07E6BBDD@PGSMSX103.gar.corp.intel.com>
     [not found]   ` <20181112140305.GD17131@6wind.com>
2018-11-13  1:29     ` [dpdk-dev] FW: " Zhao1, Wei
2018-11-13  2:27       ` Peng, Yuan
2018-11-13  2:41         ` Zhao1, Wei
2018-11-13 21:28           ` Ferruh Yigit
2018-11-13 22:41             ` Zhang, Qi Z
2018-11-13 22:40 ` [dpdk-dev] " Zhang, Qi Z
2018-11-13 23:11 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-11-14  4:12   ` Zhao1, Wei

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