net/i40e: add parameter check for RSS flow init
PATCH 1/1 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.
--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +4 -1
@@ -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), };
Signature · 1 line
2.7.5
A message that is not in the archive (sent off-list or not yet received): A2573D2ACFCADC41BB3BE09C6DE313CA07E6BBDD@PGSMSX103.gar.corp.intel.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi, Adrien Mazarguil
Peng yuan has find this problem, if you use the following test step, You will find the problem.
./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=8 --rxq=4 --txq=4 --port-topology=chained
...............
testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end key 67108863 / end
Segmentation fault (core dumped)
https://patches.dpdk.org/patch/47995/
This is the protection I have add, but you still need fix some bug in rte_flow CLI.
Quoted 14 lines
-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, November 12, 2018 10:03 PM
To: Zhao1, Wei <[email protected]>
Cc: Peng, Yuan <[email protected]>
Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi Wei,
Quoted 4 lines · Wei
Hi, adrien.mazarguil
There is some error in CML layer for config this parameter, in
i40e PMD it will get NULL ofin->keyeven if tester config Some specific key
Quoted 8 lines
from testpmd CLI, I add some protection but you also need fix that bug in CLI layer.
Odd, is that new? You shouldn't need to worry about the pointer if
key_lenis zero.Isn't this problem related to commit
a4391f8bae85"app/testpmd: set default RSS key as null"? There's an ongoing discussion to revert this patch [1].
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end key 67108863 / end
This CLI command key is not NLLL, but i40E PMD get NULL.
Quoted 51 lines
[1] https://mails.dpdk.org/archives/dev/2018-November/118633.html
Quoted 36 lines
Quoted 36 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 5:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow initThere 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 flowAPI")
Signed-off-by Wei Zhao <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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,Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-1.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--
Adrien Mazarguil
6WIND
Hi, Adrien Mazarguil
Yes. It's just the problem related to commit a4391f8bae85db0153e1f101c21c61151573baad "app/testpmd: set default RSS key as null". You can check the detailed bug information from https://jira01.devtools.intel.com/browse/DPDK-7136?filter=-2
Thank you.
Yuan.
-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, November 13, 2018 9:29 AM
To: Adrien Mazarguil <[email protected]>
Cc: Peng, Yuan <[email protected]>; [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow init
Hi, Adrien Mazarguil
Peng yuan has find this problem, if you use the following test step, You will find the problem.
./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=8 --rxq=4 --txq=4 --port-topology=chained ............... testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp
testpmd> end key 67108863 / end
Segmentation fault (core dumped)
https://patches.dpdk.org/patch/47995/
This is the protection I have add, but you still need fix some bug in rte_flow CLI.
Quoted 14 lines
-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, November 12, 2018 10:03 PM
To: Zhao1, Wei <[email protected]>
Cc: Peng, Yuan <[email protected]>
Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi Wei,
Quoted 4 lines · Wei
Hi, adrien.mazarguil
There is some error in CML layer for config this parameter, in
i40e PMD it will get NULL ofin->keyeven if tester config Some specific key
Quoted 8 lines
from testpmd CLI, I add some protection but you also need fix that bug in CLI layer.
Odd, is that new? You shouldn't need to worry about the pointer if
key_lenis zero.Isn't this problem related to commit
a4391f8bae85"app/testpmd: set default RSS key as null"? There's an ongoing discussion to revert this patch [1].
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end key 67108863 / end
This CLI command key is not NLLL, but i40E PMD get NULL.
Quoted 51 lines
[1] https://mails.dpdk.org/archives/dev/2018-November/118633.html
Quoted 36 lines
Quoted 36 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 5:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow initThere 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 flowAPI")
Signed-off-by Wei Zhao <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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,Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-1.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--
Adrien Mazarguil
6WIND
Add Ophir Munk for discussion.
Quoted 126 lines
-----Original Message-----
From: Peng, Yuan
Sent: Tuesday, November 13, 2018 10:27 AM
To: Zhao1, Wei <[email protected]>; Adrien Mazarguil <[email protected]>
Cc: [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Yes. It's just the problem related to commit
a4391f8bae85db0153e1f101c21c61151573baad"app/testpmd: set default RSS key as null".
You can check the detailed bug information from
https://jira01.devtools.intel.com/browse/DPDK-7136?filter=-2Thank you.
Yuan.-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, November 13, 2018 9:29 AM
To: Adrien Mazarguil <[email protected]>
Cc: Peng, Yuan <[email protected]>; [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Peng yuan has find this problem, if you use the following test step,
You will find the problem../x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=8 -- rxq=4 --txq=4 --port-topology=chained ...............
testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
Segmentation fault (core dumped)https://patches.dpdk.org/patch/47995/
This is the protection I have add, but you still need fix some bug inrte_flowCLI.Quoted 16 lines
-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, November 12, 2018 10:03 PM
To: Zhao1, Wei <[email protected]>
Cc: Peng, Yuan <[email protected]>
Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi Wei,
Quoted 5 lines · Wei
Hi, adrien.mazarguil
There is some error in CML layer for config this parameter, in
i40e PMD it will get NULL ofin->keyeven if tester config Some specific keyQuoted 8 lines
from testpmd CLI, I add some protection but you also need fix that bug in CLI layer.
Odd, is that new? You shouldn't need to worry about the pointer if
key_lenis zero.Isn't this problem related to commit
a4391f8bae85"app/testpmd: set default RSS key as null"? There's an ongoing discussion to revert this patch[1].
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
This CLI command key is not NLLL, but i40E PMD get NULL.
Quoted 51 lines
[1] https://mails.dpdk.org/archives/dev/2018-November/118633.html
Quoted 36 lines
Quoted 36 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 5:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow initThere 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 flowAPI")
Signed-off-by Wei Zhao <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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,Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-1.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--
Adrien Mazarguil
6WIND
Quoted 40 lines · Wei
Add Ophir Munk for discussion.
Quoted 37 lines
-----Original Message-----
From: Peng, Yuan
Sent: Tuesday, November 13, 2018 10:27 AM
To: Zhao1, Wei <[email protected]>; Adrien Mazarguil <[email protected]>
Cc: [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Yes. It's just the problem related to commit
a4391f8bae85db0153e1f101c21c61151573baad"app/testpmd: set default RSS key as null".
You can check the detailed bug information from
https://jira01.devtools.intel.com/browse/DPDK-7136?filter=-2Thank you.
Yuan.-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, November 13, 2018 9:29 AM
To: Adrien Mazarguil <[email protected]>
Cc: Peng, Yuan <[email protected]>; [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Peng yuan has find this problem, if you use the following test step,
You will find the problem../x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=8 -- rxq=4 --txq=4 --port-topology=chained ...............
testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
Segmentation fault (core dumped)
The patch causing the crash reverted [1], change will be on RC3 so this should be solved already, you can verify it with head of next-net.
Still, this patch adds some checks, no harm to have them if you still want to have it in? (perhaps only need to drop Fixes line.)
Qi,
What do you think, does it have any risk to get it on rc3? Or should we push to next release since it turned out to be extra safety checks now?
[1]
Commit 8773db152033 ("app/testpmd: revert setting default RSS")
Quoted 89 lines
Quoted 89 lines
https://patches.dpdk.org/patch/47995/
This is the protection I have add, but you still need fix some bug inrte_flowCLI.Quoted 16 lines
-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, November 12, 2018 10:03 PM
To: Zhao1, Wei <[email protected]>
Cc: Peng, Yuan <[email protected]>
Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi Wei,
Quoted 5 lines · Wei
Hi, adrien.mazarguil
There is some error in CML layer for config this parameter, in
i40e PMD it will get NULL ofin->keyeven if tester config Some specific keyQuoted 8 lines
from testpmd CLI, I add some protection but you also need fix that bug in CLI layer.
Odd, is that new? You shouldn't need to worry about the pointer if
key_lenis zero.Isn't this problem related to commit
a4391f8bae85"app/testpmd: set default RSS key as null"? There's an ongoing discussion to revert this patch[1].
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
This CLI command key is not NLLL, but i40E PMD get NULL.
Quoted 51 lines
[1] https://mails.dpdk.org/archives/dev/2018-November/118633.html
Quoted 36 lines
Quoted 36 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 5:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow initThere 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 flowAPI")
Signed-off-by Wei Zhao <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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,Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-1.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--
Adrien Mazarguil
6WIND
Quoted 63 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, November 13, 2018 1:28 PM
To: Zhao1, Wei <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Peng, Yuan <[email protected]>; Adrien Mazarguil <[email protected]>
Subject: Re: [dpdk-dev] FW: [PATCH] net/i40e: add parameter check for RSS flow initQuoted 43 lines · Wei
Add Ophir Munk for discussion.
Quoted 40 lines
-----Original Message-----
From: Peng, Yuan
Sent: Tuesday, November 13, 2018 10:27 AM
To: Zhao1, Wei <[email protected]>; Adrien Mazarguil <[email protected]>
Cc: [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Yes. It's just the problem related to commit
a4391f8bae85db0153e1f101c21c61151573baad"app/testpmd: set default RSS key as null".
You can check the detailed bug information from
https://jira01.devtools.intel.com/browse/DPDK-7136?filter=-2Thank you.
Yuan.-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, November 13, 2018 9:29 AM
To: Adrien Mazarguil <[email protected]>
Cc: Peng, Yuan <[email protected]>; [email protected]
Subject: RE: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi, Adrien Mazarguil
Peng yuan has find this problem, if you use the following test
step, You will find the problem../x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=8 --
rxq=4 --txq=4 --port-topology=chained ............... testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
Segmentation fault (core dumped)The patch causing the crash reverted [1], change will be on RC3 so this should be solved already, you can verify it with head of next-net.
Still, this patch adds some checks, no harm to have them if you still want to have it in? (perhaps only need to drop Fixes line.)
Quoted 7 lines
Qi,
What do you think, does it have any risk to get it on rc3? Or should we push to next release since it turned out to be extra safety checks now?
[1]
Commit8773db152033("app/testpmd: revert setting default RSS")
I have no objection to add safe check in i40e driver here, looks like it should not rely on other part of the application to guarantee the key is not empty. Maybe It's even better to have some warning log when that case happen.
I have applied it, since the patch is not harmful at least and we don't need to wait for verification for [1].
Regards
Qi
Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
https://patches.dpdk.org/patch/47995/
This is the protection I have add, but you still need fix some bug inrte_flowCLI.Quoted 19 lines
-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, November 12, 2018 10:03 PM
To: Zhao1, Wei <[email protected]>
Cc: Peng, Yuan <[email protected]>
Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow initHi Wei,
Quoted 5 lines · Wei
Hi, adrien.mazarguil
There is some error in CML layer for config this parameter, in
i40e PMD it will get NULL ofin->keyeven if tester config Some specific keyfrom testpmd CLI, I add some protection but you also need fix that bug in CLI layer.
Quoted 6 lines
Odd, is that new? You shouldn't need to worry about the pointer if
key_lenis zero.Isn't this problem related to commit
a4391f8bae85"app/testpmd: set default RSS key as null"? There's an ongoing discussion to revert this patch[1].
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp testpmd> end key 67108863 / end
This CLI command key is not NLLL, but i40E PMD get NULL.
Quoted 51 lines
[1] https://mails.dpdk.org/archives/dev/2018-November/118633.html
Quoted 36 lines
Quoted 36 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 5:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow initThere 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 flowAPI")
Signed-off-by Wei Zhao <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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,Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-1.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--
Adrien Mazarguil
6WIND
Quoted 10 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Monday, November 12, 2018 1:25 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: add parameter check for RSS flow init
Quoted 6 lines
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 <[email protected]>
Applied to dpdk-next-net-net.
Thanks
Qi
Quoted 29 lines
--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_ethdev.c +4
-1@@ -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
Quoted 15 lines · 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 <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_ethdev.c +0
-0
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 12558
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +4
-0@@ -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);
Giving following warning [1] with clang, which looks like valid warning. i40e_rte_flow_rss_conf->key is an array, no need to check its address.
I will remove it while merging.
[1].../drivers/net/i40e/i40e_ethdev.c:12557:11: error: address of array 'out->key' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
if (out->key && in->key)
~~~~~^~~ ~~Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c +0
-1out->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), };
Quoted 28 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 14, 2018 7:11 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Peng, Yuan <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] net/i40e: add parameter check for RSS flow initdrivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct
Quoted 15 lines · 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 <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 1c77906..217a8dc 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -12552,13 +12552,16 @@ i40e_rss_conf_init(struct
i40e_rte_flow_rss_conf*out,
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 12558
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +4
-0if (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);Giving following warning [1] with clang, which looks like valid warning.
i40e_rte_flow_rss_conf->keyis an array, no need to check its address.
Yes, you are right, thanks.
Quoted 23 lines
I will remove it while merging.
[1]
.../drivers/net/i40e/i40e_ethdev.c:12557:11: error: address of array 'out-Quoted 1 line
key'
will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
if (out->key && in->key) ~~~~~^~~ ~~Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c +0
-1out->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), };