summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-03-02 21:06:30 -0800
committerDave Barach <openvpp@barachs.net>2022-03-03 19:15:43 +0000
commit54223ee25756faa0ced82c5bcb9a8ac633ccdbd8 (patch)
treeb6875ff0adcf1639c7427dd839478d5a46bffc67 /src/vcl
parentbb5e2fc2c4a37ccc07cc16ed5601c983cd74d8ec (diff)
vcl: validate vls_epoll_ctl inputs
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I315ef0122ccb21ccfef117a58b1dc998127618ce
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_locked.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c
index 5ec553e2c8b..f6df0fbd5b7 100644
--- a/src/vcl/vcl_locked.c
+++ b/src/vcl/vcl_locked.c
@@ -1481,17 +1481,33 @@ vls_epoll_ctl (vls_handle_t ep_vlsh, int op, vls_handle_t vlsh,
vls_mt_detect ();
vls_mt_pool_rlock ();
+
ep_vls = vls_get_and_lock (ep_vlsh);
+ if (PREDICT_FALSE (!ep_vls))
+ {
+ vls_mt_pool_runlock ();
+ return VPPCOM_EBADFD;
+ }
if (vls_mt_session_should_migrate (ep_vls))
{
ep_vls = vls_mt_session_migrate (ep_vls);
if (PREDICT_FALSE (!ep_vls))
- return VPPCOM_EBADFD;
+ {
+ vls_mt_pool_runlock ();
+ return VPPCOM_EBADFD;
+ }
}
- ep_sh = vls_to_sh (ep_vls);
vls = vls_get_and_lock (vlsh);
+ if (PREDICT_FALSE (!vls))
+ {
+ vls_unlock (ep_vls);
+ vls_mt_pool_runlock ();
+ return VPPCOM_EBADFD;
+ }
+
+ ep_sh = vls_to_sh (ep_vls);
sh = vls_to_sh (vls);
vls_epoll_ctl_mp_checks (vls, op);