Fix memory corruption faulting [VPP-1639]

File pool may be reallocated on epoll events processing. 
*f* pointer shows to already freed address and corrupting 
memory chunk on clib_file_t property change.

Change-Id: I751bddce27325452862b939c1a3eec2ccd9b71bb
Signed-off-by: Artem Belov <artem.belov@xored.com>
This commit is contained in:
Artem Belov
2019-04-18 07:30:43 +00:00
committed by Florin Coras
parent 0a84680674
commit 32b07c3187

View File

@ -285,14 +285,14 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{ {
if (e->events & EPOLLIN) if (e->events & EPOLLIN)
{ {
errors[n_errors] = f->read_function (f);
f->read_events++; f->read_events++;
errors[n_errors] = f->read_function (f);
n_errors += errors[n_errors] != 0; n_errors += errors[n_errors] != 0;
} }
if (e->events & EPOLLOUT) if (e->events & EPOLLOUT)
{ {
errors[n_errors] = f->write_function (f);
f->write_events++; f->write_events++;
errors[n_errors] = f->write_function (f);
n_errors += errors[n_errors] != 0; n_errors += errors[n_errors] != 0;
} }
} }
@ -300,8 +300,8 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{ {
if (f->error_function) if (f->error_function)
{ {
errors[n_errors] = f->error_function (f);
f->error_events++; f->error_events++;
errors[n_errors] = f->error_function (f);
n_errors += errors[n_errors] != 0; n_errors += errors[n_errors] != 0;
} }
else else