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")
Cc: stable@dpdk.org
Signed-off-by: Alan Dewar <adewar@brocade.com>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
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);