summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-07-25 14:51:09 -0700
committerDave Barach <openvpp@barachs.net>2019-07-29 20:46:46 +0000
commit2b5fed8696ce2a9b67e63cf5b5dbf49505172c9a (patch)
treee737297817caba79e3657b1c101d41b9802a7bf9 /src/vnet/session/session_node.c
parent1a3d2370b53bcdb13581d8be0d9410974b9966c3 (diff)
session: fix vpp to app msg generation
Type:fix Freeing mq messages in vpp (producer), if enqueueing fails, invalidates consumer assumption that messages can be freed without a lock. Change-Id: I748a33b8846597bdad865945d8e899346d482434 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Tal Saiag <tal.saiag@gmail.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r--src/vnet/session/session_node.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 35704b75a0a..bffae62ff79 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -175,7 +175,6 @@ session_mq_disconnected_handler (void *data)
svm_msg_q_lock_and_alloc_msg_w_ring (app_wrk->event_queue,
SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_wrk->event_queue);
evt = svm_msg_q_msg_data (app_wrk->event_queue, msg);
clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED_REPLY;
@@ -183,7 +182,7 @@ session_mq_disconnected_handler (void *data)
rmp->handle = mp->handle;
rmp->context = mp->context;
rmp->retval = rv;
- svm_msg_q_add (app_wrk->event_queue, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_wrk->event_queue, msg);
}
static void
@@ -250,13 +249,12 @@ session_mq_worker_update_handler (void *data)
svm_msg_q_lock_and_alloc_msg_w_ring (app_wrk->event_queue,
SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_wrk->event_queue);
evt = svm_msg_q_msg_data (app_wrk->event_queue, msg);
clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_REQ_WORKER_UPDATE;
wump = (session_req_worker_update_msg_t *) evt->data;
wump->session_handle = mp->handle;
- svm_msg_q_add (app_wrk->event_queue, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_wrk->event_queue, msg);
return;
}
@@ -268,7 +266,6 @@ session_mq_worker_update_handler (void *data)
svm_msg_q_lock_and_alloc_msg_w_ring (app_wrk->event_queue,
SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_wrk->event_queue);
evt = svm_msg_q_msg_data (app_wrk->event_queue, msg);
clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_WORKER_UPDATE_REPLY;
@@ -277,7 +274,7 @@ session_mq_worker_update_handler (void *data)
rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
rmp->segment_handle = session_segment_handle (s);
- svm_msg_q_add (app_wrk->event_queue, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_wrk->event_queue, msg);
/*
* Retransmit messages that may have been lost