CVSROOT:        /cvs
Module name:    src
Changes by:     sas...@cvs.openbsd.org  2021/06/02 15:49:32

Modified files:
        sys/net        : if_pfsync.c 

Log message:
With parallel execution of pf_test() two packets may try to update the same
state in pfsync(4) queue. pfsync_q_ins() takes that race into account with one
exception: the KASSERT() at line 2352. That KASSERT()  needs to be removed.

2346 void
2347 pfsync_q_ins(struct pf_state *st, int q)
2348 {
2349    struct pfsync_softc *sc = pfsyncif;
2350    size_t nlen, sc_len;
2351
2352    KASSERT(st->sync_state == PFSYNC_S_NONE);
2353
2354 #if defined(PFSYNC_DEBUG)
2355         if (sc->sc_len < PFSYNC_MINPKT)
2356                 panic("pfsync pkt len is too low %zd", sc->sc_len);
2357 #endif
2358 do {
2359         mtx_enter(&sc->sc_mtx[q]);
2360
2361         /*
2362          * If two threads are competing to insert the same state, then
2363          * there must be just single winner.
2364          */
2365         if (st->sync_state != PFSYNC_S_NONE) {
2366                 mtx_leave(&sc->sc_mtx[q]);
2367                 break;
2368         }

OK bluhm@

Reply via email to