If eventdev enqueue or dequeue function is called during
event_dev_fp_ops_set(), it may get pre-empted after setting
the function pointers, but before setting the pointer to port data.
In this case the newly registered enqueue/dequeue function will use
dummy port data and end up in seg fault.

This patch moves the updation of data element to the beginning of
event_dev_fp_ops_set() function.

Fixes: d35e61322de5 ("eventdev: move inline APIs into separate structure")
Cc: sta...@dpdk.org

Signed-off-by: Ashok Kaladi <ashok.k.kal...@intel.com>

diff --git a/.mailmap b/.mailmap
index 5015494210..bbf6744278 100644
--- a/.mailmap
+++ b/.mailmap
@@ -132,6 +132,7 @@ Ashish Jain <ashish.j...@nxp.com>
 Ashish Paul <ap...@juniper.net>
 Ashish Sadanandan <ashish.sadanan...@gmail.com>
 Ashish Shah <ashish.n.s...@intel.com>
+Ashok Kaladi <ashok.k.kal...@intel.com>
 Ashwin Sekhar T K <asek...@marvell.com> <ashwin.sek...@caviumnetworks.com>
 Asim Jamshed <asim.jams...@gmail.com>
 Aviad Yehezkel <avia...@mellanox.com>
diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_private.c
index 1d3d9d357e..539aade780 100644
--- a/lib/eventdev/eventdev_private.c
+++ b/lib/eventdev/eventdev_private.c
@@ -107,6 +107,7 @@ void
 event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op,
                     const struct rte_eventdev *dev)
 {
+       fp_op->data = dev->data->ports;
        fp_op->enqueue = dev->enqueue;
        fp_op->enqueue_burst = dev->enqueue_burst;
        fp_op->enqueue_new_burst = dev->enqueue_new_burst;
@@ -117,5 +118,4 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op,
        fp_op->txa_enqueue = dev->txa_enqueue;
        fp_op->txa_enqueue_same_dest = dev->txa_enqueue_same_dest;
        fp_op->ca_enqueue = dev->ca_enqueue;
-       fp_op->data = dev->data->ports;
 }
-- 
2.25.1

Reply via email to