# HG changeset patch # User Roy Marples # Date 1601323821 -3600 # Node ID 23f35ea1a34a681f224f72bb285d6f463b02f7f5 # Parent 8e2b8ce8c9724ac5a4904ea7ac001532599cab2f privsep: fix crash when interface departs before bpf returns for it diff -r 8e2b8ce8c972 -r 23f35ea1a34a src/dhcp.c --- a/src/dhcp.c Mon Sep 28 17:09:38 2020 +0100 +++ b/src/dhcp.c Mon Sep 28 21:10:21 2020 +0100 @@ -3477,6 +3477,9 @@ #ifdef PRIVSEP const struct dhcp_state *state = D_CSTATE(ifp); + if (state == NULL) + return; + /* Ignore double reads */ if (IN_PRIVSEP(ifp->ctx)) { switch (state->state) { diff -r 8e2b8ce8c972 -r 23f35ea1a34a src/privsep-bpf.c --- a/src/privsep-bpf.c Mon Sep 28 17:09:38 2020 +0100 +++ b/src/privsep-bpf.c Mon Sep 28 21:10:21 2020 +0100 @@ -266,6 +266,10 @@ size_t bpf_len; ifp = if_findindex(ctx->ifaces, psm->ps_id.psi_ifindex); + /* interface may have departed .... */ + if (ifp == NULL) + return -1; + bpf = iov->iov_base; bpf_len = iov->iov_len;