From: Wei Zhao Date: Mon, 12 Nov 2018 09:25:24 +0000 (+0800) Subject: net/i40e: add parameter check for RSS flow init X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=264b23e3d2c1;p=dpdk.git net/i40e: add parameter check for RSS flow init There need an parameter check for RSS flow init, or it may cause core dump if pointer is NULL in memory copy. Signed-off-by: Wei Zhao Acked-by: Qi Zhang --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 1c779068a0..790ecc3cce 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 (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), };