diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2021-12-02 13:32:21 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2021-12-13 08:54:15 +0000 |
| commit | bbbe18b317956f3e0d87a277acc1941222fa8eb9 (patch) | |
| tree | 12a7403f9a8854131138542b679326f1a9c32667 | |
| parent | de63ba95e38200b16b205da95af49dbdf4d1ea39 (diff) | |
pfsync: NULL check sc before using it
In pfsync_defer() we must wait to lock sc until we've ensured it's not
NULL.
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33240
(cherry picked from commit 27bd812c5c92af9e7acdbf100bd98166a717bb76)
| -rw-r--r-- | sys/netpfil/pf/if_pfsync.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 8feaea615867..d6016766ddcc 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1741,9 +1741,12 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m) if (m->m_flags & (M_BCAST|M_MCAST)) return (0); + if (sc == NULL) + return (0); + PFSYNC_LOCK(sc); - if (sc == NULL || !(sc->sc_ifp->if_flags & IFF_DRV_RUNNING) || + if (!(sc->sc_ifp->if_flags & IFF_DRV_RUNNING) || !(sc->sc_flags & PFSYNCF_DEFER)) { PFSYNC_UNLOCK(sc); return (0); |
