aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-12-26 16:29:06 -0800
committerFlorin Coras <florin.coras@gmail.com>2018-12-28 20:41:31 +0000
commitfa915f8180d620b5325789200e08fec674d390ba (patch)
tree17941700fab8a387466963f5e4189e2488d13934 /src/vcl/vppcom.c
parentfe4827c97d375d5849aa5db863030af48069bdc2 (diff)
vcl: handle invalid sessions in epoll
Change-Id: I62d37f3c05451e5667863a2c6c551872d5dac1ea Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index be3081edcf5..86bb21413a4 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2542,7 +2542,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
ASSERT (e->fifo->client_thread_index == vcl_get_worker_index ());
vcl_fifo_rx_evt_valid_or_break (e->fifo);
sid = e->fifo->client_session_index;
- session = vcl_session_get (wrk, sid);
+ if (!(session = vcl_session_get (wrk, sid)))
+ break;
session_events = session->vep.ev.events;
if (!(EPOLLIN & session->vep.ev.events) || session->has_rx_evt)
break;
@@ -2553,7 +2554,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
case FIFO_EVENT_APP_TX:
sid = e->fifo->client_session_index;
- session = vcl_session_get (wrk, sid);
+ if (!(session = vcl_session_get (wrk, sid)))
+ break;
session_events = session->vep.ev.events;
if (!(EPOLLOUT & session_events))
break;
@@ -2564,6 +2566,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
case SESSION_IO_EVT_CT_TX:
vcl_fifo_rx_evt_valid_or_break (e->fifo);
session = vcl_ct_session_get_from_fifo (wrk, e->fifo, 0);
+ if (PREDICT_FALSE (!session))
+ break;
sid = session->session_index;
session_events = session->vep.ev.events;
if (!(EPOLLIN & session->vep.ev.events) || session->has_rx_evt)
@@ -2575,6 +2579,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
case SESSION_IO_EVT_CT_RX:
session = vcl_ct_session_get_from_fifo (wrk, e->fifo, 1);
+ if (PREDICT_FALSE (!session))
+ break;
sid = session->session_index;
session_events = session->vep.ev.events;
if (!(EPOLLOUT & session_events))
@@ -2602,7 +2608,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
vcl_session_connected_handler (wrk, connected_msg);
/* Generate EPOLLOUT because there's no connected event */
sid = vcl_session_index_from_vpp_handle (wrk, connected_msg->handle);
- session = vcl_session_get (wrk, sid);
+ if (!(session = vcl_session_get (wrk, sid)))
+ break;
session_events = session->vep.ev.events;
if (EPOLLOUT & session_events)
{