diff options
author | Florin Coras <fcoras@cisco.com> | 2021-06-04 17:31:53 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2021-06-07 21:25:49 +0000 |
commit | 53af06a214c15b9113df8ce66a6e95881370bb46 (patch) | |
tree | 1e8716b5e0a59292b49a115031e70281f12f2981 /src/vcl | |
parent | 2fea186aeec9c40adf13042669a4de3670f5e5cd (diff) |
vcl: accept zero length writes
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I84985f59274e77219a38ea6ac865fc73ac635d72
(cherry picked from commit 0b0d28e9bf1ea078ce1a846d22e499d13eadd464)
Diffstat (limited to 'src/vcl')
-rw-r--r-- | src/vcl/vppcom.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index e98f9b7c84a..ebc9e768b0c 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -2148,8 +2148,12 @@ vppcom_session_write_inline (vcl_worker_t * wrk, vcl_session_t * s, void *buf, svm_msg_q_t *mq; u8 is_ct; - if (PREDICT_FALSE (!buf || n == 0)) - return VPPCOM_EINVAL; + /* Accept zero length writes but just return */ + if (PREDICT_FALSE (!n)) + return VPPCOM_OK; + + if (PREDICT_FALSE (!buf)) + return VPPCOM_EFAULT; if (PREDICT_FALSE (s->flags & VCL_SESSION_F_IS_VEP)) { @@ -2159,7 +2163,7 @@ vppcom_session_write_inline (vcl_worker_t * wrk, vcl_session_t * s, void *buf, } if (PREDICT_FALSE (!vcl_session_is_open (s) || - s->flags & VCL_SESSION_F_SHUTDOWN)) + (s->flags & VCL_SESSION_F_SHUTDOWN))) { VDBG (1, "session %u [0x%llx]: is not open! state 0x%x (%s)", s->session_index, s->vpp_handle, s->session_state, @@ -3885,12 +3889,9 @@ vppcom_session_sendto (uint32_t session_handle, void *buffer, vcl_session_t *s; s = vcl_session_get_w_handle (wrk, session_handle); - if (!s) + if (PREDICT_FALSE (!s)) return VPPCOM_EBADFD; - if (!buffer) - return VPPCOM_EINVAL; - if (ep) { if (!vcl_session_is_cl (s)) |