DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port
@ 2017-02-06 17:32 Jan Blunck
  2017-02-06 18:42 ` Dumitrescu, Cristian
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Blunck @ 2017-02-06 17:32 UTC (permalink / raw)
  To: dev; +Cc: h.mikita89, Alan Dewar

From: Alan Dewar <adewar@brocade.com>

Prevent a segmentation fault in rte_sched_port_free by only accessing
the port structure after the NULL pointer check has been made.

Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets")

Signed-off-by: Alan Dewar <adewar@brocade.com>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 lib/librte_sched/rte_sched.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index e6dace2..614705d 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -735,12 +735,14 @@ void
 rte_sched_port_free(struct rte_sched_port *port)
 {
 	uint32_t qindex;
-	uint32_t n_queues_per_port = rte_sched_port_queues_per_port(port);
+	uint32_t n_queues_per_port;
 
 	/* Check user parameters */
 	if (port == NULL)
 		return;
 
+	n_queues_per_port = rte_sched_port_queues_per_port(port);
+
 	/* Free enqueued mbufs */
 	for (qindex = 0; qindex < n_queues_per_port; qindex++) {
 		struct rte_mbuf **mbufs = rte_sched_port_qbase(port, qindex);
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port
  2017-02-06 17:32 [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port Jan Blunck
@ 2017-02-06 18:42 ` Dumitrescu, Cristian
  2017-02-09 17:48   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Dumitrescu, Cristian @ 2017-02-06 18:42 UTC (permalink / raw)
  To: Jan Blunck, dev; +Cc: h.mikita89, Alan Dewar



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jan Blunck
> Sent: Monday, February 6, 2017 5:33 PM
> To: dev@dpdk.org
> Cc: h.mikita89@gmail.com; Alan Dewar <adewar@brocade.com>
> Subject: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port
> 
> From: Alan Dewar <adewar@brocade.com>
> 
> Prevent a segmentation fault in rte_sched_port_free by only accessing
> the port structure after the NULL pointer check has been made.
> 
> Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets")
> 
> Signed-off-by: Alan Dewar <adewar@brocade.com>
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>  lib/librte_sched/rte_sched.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index e6dace2..614705d 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -735,12 +735,14 @@ void
>  rte_sched_port_free(struct rte_sched_port *port)
>  {
>  	uint32_t qindex;
> -	uint32_t n_queues_per_port =
> rte_sched_port_queues_per_port(port);
> +	uint32_t n_queues_per_port;
> 
>  	/* Check user parameters */
>  	if (port == NULL)
>  		return;
> 
> +	n_queues_per_port = rte_sched_port_queues_per_port(port);
> +
>  	/* Free enqueued mbufs */
>  	for (qindex = 0; qindex < n_queues_per_port; qindex++) {
>  		struct rte_mbuf **mbufs = rte_sched_port_qbase(port,
> qindex);
> --
> 2.7.4

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

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

* Re: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port
  2017-02-06 18:42 ` Dumitrescu, Cristian
@ 2017-02-09 17:48   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-02-09 17:48 UTC (permalink / raw)
  To: Jan Blunck, Alan Dewar; +Cc: dev, Dumitrescu, Cristian, h.mikita89, stable

> > Prevent a segmentation fault in rte_sched_port_free by only accessing
> > the port structure after the NULL pointer check has been made.
> > 
> > Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets")
> > 
> > Signed-off-by: Alan Dewar <adewar@brocade.com>
> > Signed-off-by: Jan Blunck <jblunck@infradead.org>
> 
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Cc: stable@dpdk.org

Applied, thanks

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

end of thread, other threads:[~2017-02-09 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 17:32 [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port Jan Blunck
2017-02-06 18:42 ` Dumitrescu, Cristian
2017-02-09 17:48   ` 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).