Skip to content

Commit

Permalink
Fix TOCTOU like issue in conn_closed caused by the a filedescriptor n…
Browse files Browse the repository at this point in the history
…ot being removed from the event loop before it's been freed
  • Loading branch information
arr2036 committed Dec 14, 2019
1 parent b76c735 commit 6c66053
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/rlm_radius/rlm_radius_udp.c
Expand Up @@ -505,13 +505,15 @@ static void conn_error(UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int fla
/** Shutdown/close a file descriptor
*
*/
static void _conn_close(UNUSED fr_event_list_t *el, void *h, void *uctx)
static void _conn_close(fr_event_list_t *el, void *h, void *uctx)
{
int fd = *((int *)h);
fr_io_connection_t *c = talloc_get_type_abort(uctx, fr_io_connection_t);

if (c->idle_ev) fr_event_timer_delete(c->thread->el, &c->idle_ev);

fr_event_fd_delete(c->el, fd, FR_EVENT_FILTER_IO);

if (shutdown(fd, SHUT_RDWR) < 0) {
DEBUG3("%s - Failed shutting down connection %s: %s",
c->module_name, c->name, fr_syserror(errno));
Expand Down

0 comments on commit 6c66053

Please sign in to comment.