* [dpdk-dev] [PATCH] examples/l3fwd: fix validation for queue id of config tuple
@ 2016-03-18 10:35 Reshma Pattan
2016-03-21 14:12 ` Thomas Monjalon
2016-03-24 23:11 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
0 siblings, 2 replies; 7+ messages in thread
From: Reshma Pattan @ 2016-03-18 10:35 UTC (permalink / raw)
To: dev, konstantin.ananyev; +Cc: Reshma Pattan
Added validation for queue id of config parameter tuple.
This validation enforces user to enter queue ids of a port
from 0 and in sequence.
This additional validation on queue ids avoids ixgbe crash caused by null
rxq pointer access inside ixgbe_dev_rx_init.
Reason for null rxq is, L3fwd application allocates memory only for queues passed by user.
But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues,
which is not true and coredump while accessing the unallocated queue .
Fixes: Commit af75078f
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
examples/l3fwd/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 0e33039..f148d4e 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -264,8 +264,14 @@ get_port_n_rx_queues(const uint8_t port)
for (i = 0; i < nb_lcore_params; ++i) {
if (lcore_params[i].port_id == port &&
- lcore_params[i].queue_id > queue)
+ lcore_params[i].queue_id > queue &&
+ lcore_params[i].queue_id == queue+1)
queue = lcore_params[i].queue_id;
+ else if (lcore_params[i].port_id == port &&
+ lcore_params[i].queue_id != queue+1)
+ rte_exit(EXIT_FAILURE, "queue ids of the port %d must be"
+ " in sequence and must start with 0",
+ lcore_params[i].port_id);
}
return (uint8_t)(++queue);
}
--
2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/l3fwd: fix validation for queue id of config tuple
2016-03-18 10:35 [dpdk-dev] [PATCH] examples/l3fwd: fix validation for queue id of config tuple Reshma Pattan
@ 2016-03-21 14:12 ` Thomas Monjalon
2016-03-24 23:11 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2016-03-21 14:12 UTC (permalink / raw)
To: Reshma Pattan; +Cc: dev, konstantin.ananyev
2016-03-18 10:35, Reshma Pattan:
> Added validation for queue id of config parameter tuple.
>
> This validation enforces user to enter queue ids of a port
> from 0 and in sequence.
>
> This additional validation on queue ids avoids ixgbe crash caused by null
> rxq pointer access inside ixgbe_dev_rx_init.
>
> Reason for null rxq is, L3fwd application allocates memory only for queues passed by user.
> But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues,
> which is not true and coredump while accessing the unallocated queue .
>
> Fixes: Commit af75078f
Fixes: af75078fece3 ("first public release")
> for (i = 0; i < nb_lcore_params; ++i) {
> if (lcore_params[i].port_id == port &&
> - lcore_params[i].queue_id > queue)
> + lcore_params[i].queue_id > queue &&
This check is not really useful if queue_id == queue+1
> + lcore_params[i].queue_id == queue+1)
> queue = lcore_params[i].queue_id;
> + else if (lcore_params[i].port_id == port &&
This line repeats the above check.
You can nest the "if" instead of "else if".
> + lcore_params[i].queue_id != queue+1)
> + rte_exit(EXIT_FAILURE, "queue ids of the port %d must be"
> + " in sequence and must start with 0",
> + lcore_params[i].port_id);
> }
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] examples/l3fwd: fix validation for queue id of config tuple
2016-03-18 10:35 [dpdk-dev] [PATCH] examples/l3fwd: fix validation for queue id of config tuple Reshma Pattan
2016-03-21 14:12 ` Thomas Monjalon
@ 2016-03-24 23:11 ` Reshma Pattan
2016-03-25 14:14 ` De Lara Guarch, Pablo
2016-03-25 15:13 ` [dpdk-dev] [PATCH v3] " Reshma Pattan
1 sibling, 2 replies; 7+ messages in thread
From: Reshma Pattan @ 2016-03-24 23:11 UTC (permalink / raw)
To: dev, konstantin.ananyev; +Cc: Reshma Pattan
Added validation for queue id of config parameter tuple.
This validation enforces user to enter queue ids of a port
from 0 and in sequence.
This additional validation on queue ids avoids ixgbe crash caused by null
rxq pointer access inside ixgbe_dev_rx_init.
Reason for null rxq is, L3fwd application allocates memory only for queues passed by user.
But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues,
which is not true and coredump while accessing the unallocated queue .
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
v2:
used nested if instead of if and elseif.
examples/l3fwd/main.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 792894f..f297177 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -263,9 +263,14 @@ get_port_n_rx_queues(const uint8_t port)
uint16_t i;
for (i = 0; i < nb_lcore_params; ++i) {
- if (lcore_params[i].port_id == port &&
- lcore_params[i].queue_id > queue)
- queue = lcore_params[i].queue_id;
+ if (lcore_params[i].port_id == port) {
+ if (lcore_params[i].queue_id == queue+1)
+ queue = lcore_params[i].queue_id;
+ else
+ rte_exit(EXIT_FAILURE, "queue ids of the port %d must be"
+ " in sequence and must start with 0",
+ lcore_params[i].port_id);
+ }
}
return (uint8_t)(++queue);
}
--
2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] examples/l3fwd: fix validation for queue id of config tuple
2016-03-24 23:11 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
@ 2016-03-25 14:14 ` De Lara Guarch, Pablo
2016-03-25 15:13 ` [dpdk-dev] [PATCH v3] " Reshma Pattan
1 sibling, 0 replies; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2016-03-25 14:14 UTC (permalink / raw)
To: Pattan, Reshma, dev, Ananyev, Konstantin; +Cc: Pattan, Reshma
Hi Reshma,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Thursday, March 24, 2016 11:11 PM
> To: dev@dpdk.org; Ananyev, Konstantin
> Cc: Pattan, Reshma
> Subject: [dpdk-dev] [PATCH v2] examples/l3fwd: fix validation for queue id of
> config tuple
>
> Added validation for queue id of config parameter tuple.
>
> This validation enforces user to enter queue ids of a port
> from 0 and in sequence.
>
> This additional validation on queue ids avoids ixgbe crash caused by null
> rxq pointer access inside ixgbe_dev_rx_init.
>
> Reason for null rxq is, L3fwd application allocates memory only for queues
> passed by user.
> But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to
> nb_rx_queues,
> which is not true and coredump while accessing the unallocated queue .
>
You forgot to include the Fixes line.
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
> v2:
[...]
> + if (lcore_params[i].port_id == port) {
> + if (lcore_params[i].queue_id == queue+1)
> + queue = lcore_params[i].queue_id;
> + else
> + rte_exit(EXIT_FAILURE, "queue ids of the port
> %d must be"
> + " in sequence and must start
> with 0",
You should include a return at the end of the sentence.
> + lcore_params[i].port_id);
> + }
> }
> return (uint8_t)(++queue);
> }
> --
> 2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v3] examples/l3fwd: fix validation for queue id of config tuple
2016-03-24 23:11 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
2016-03-25 14:14 ` De Lara Guarch, Pablo
@ 2016-03-25 15:13 ` Reshma Pattan
2016-03-25 16:08 ` De Lara Guarch, Pablo
1 sibling, 1 reply; 7+ messages in thread
From: Reshma Pattan @ 2016-03-25 15:13 UTC (permalink / raw)
To: dev, konstantin.ananyev; +Cc: Reshma Pattan
Added validation for queue id of config parameter tuple.
This validation enforces user to enter queue ids of a port
from 0 and in sequence.
This additional validation on queue ids avoids ixgbe crash caused by null
rxq pointer access inside ixgbe_dev_rx_init.
Reason for null rxq is, L3fwd application allocates memory only for queues passed by user.
But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues,
which is not true and coredump while accessing the unallocated queue .
Fixes: af75078fece3 ("first public release")
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
v3:
added Fixes line
added "\n" at the end of err message.
v2:
used nested if instead of if and elseif.
examples/l3fwd/main.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 792894f..97a1423 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -263,9 +263,14 @@ get_port_n_rx_queues(const uint8_t port)
uint16_t i;
for (i = 0; i < nb_lcore_params; ++i) {
- if (lcore_params[i].port_id == port &&
- lcore_params[i].queue_id > queue)
- queue = lcore_params[i].queue_id;
+ if (lcore_params[i].port_id == port) {
+ if (lcore_params[i].queue_id == queue+1)
+ queue = lcore_params[i].queue_id;
+ else
+ rte_exit(EXIT_FAILURE, "queue ids of the port %d must be"
+ " in sequence and must start with 0\n",
+ lcore_params[i].port_id);
+ }
}
return (uint8_t)(++queue);
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v3] examples/l3fwd: fix validation for queue id of config tuple
2016-03-25 15:13 ` [dpdk-dev] [PATCH v3] " Reshma Pattan
@ 2016-03-25 16:08 ` De Lara Guarch, Pablo
2016-03-25 18:49 ` Thomas Monjalon
0 siblings, 1 reply; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2016-03-25 16:08 UTC (permalink / raw)
To: Pattan, Reshma, dev, Ananyev, Konstantin; +Cc: Pattan, Reshma
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Friday, March 25, 2016 3:14 PM
> To: dev@dpdk.org; Ananyev, Konstantin
> Cc: Pattan, Reshma
> Subject: [dpdk-dev] [PATCH v3] examples/l3fwd: fix validation for queue id of
> config tuple
>
> Added validation for queue id of config parameter tuple.
>
> This validation enforces user to enter queue ids of a port
> from 0 and in sequence.
>
> This additional validation on queue ids avoids ixgbe crash caused by null
> rxq pointer access inside ixgbe_dev_rx_init.
>
> Reason for null rxq is, L3fwd application allocates memory only for queues
> passed by user.
> But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to
> nb_rx_queues,
> which is not true and coredump while accessing the unallocated queue .
>
> Fixes: af75078fece3 ("first public release")
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v3] examples/l3fwd: fix validation for queue id of config tuple
2016-03-25 16:08 ` De Lara Guarch, Pablo
@ 2016-03-25 18:49 ` Thomas Monjalon
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2016-03-25 18:49 UTC (permalink / raw)
To: Pattan, Reshma; +Cc: dev, De Lara Guarch, Pablo, Ananyev, Konstantin
> > Added validation for queue id of config parameter tuple.
> >
> > This validation enforces user to enter queue ids of a port
> > from 0 and in sequence.
> >
> > This additional validation on queue ids avoids ixgbe crash caused by null
> > rxq pointer access inside ixgbe_dev_rx_init.
> >
> > Reason for null rxq is, L3fwd application allocates memory only for queues
> > passed by user.
> > But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to
> > nb_rx_queues,
> > which is not true and coredump while accessing the unallocated queue .
> >
> > Fixes: af75078fece3 ("first public release")
> >
> > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-25 18:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 10:35 [dpdk-dev] [PATCH] examples/l3fwd: fix validation for queue id of config tuple Reshma Pattan
2016-03-21 14:12 ` Thomas Monjalon
2016-03-24 23:11 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
2016-03-25 14:14 ` De Lara Guarch, Pablo
2016-03-25 15:13 ` [dpdk-dev] [PATCH v3] " Reshma Pattan
2016-03-25 16:08 ` De Lara Guarch, Pablo
2016-03-25 18:49 ` Thomas Monjalon
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).