diff options
author | mpi <mpi@openbsd.org> | 2018-06-06 06:47:01 +0000 |
---|---|---|
committer | mpi <mpi@openbsd.org> | 2018-06-06 06:47:01 +0000 |
commit | 2116aa4c1d3c5d67d9a15228a9488eb24d664772 (patch) | |
tree | d73478c2c3b47360ae4c85bcdac09b7f0997462a /sys/net/pfkeyv2.c | |
parent | document missing database filters (diff) | |
download | wireguard-openbsd-2116aa4c1d3c5d67d9a15228a9488eb24d664772.tar.xz wireguard-openbsd-2116aa4c1d3c5d67d9a15228a9488eb24d664772.zip |
Asseert that a pfkey or routing socket is referenced by a `fp' instead
of calling sofree(), when its PCB is detached.
This is different from TCP which does not always detach `inpcb's from
sockets. In the pfkey & routing case caling sofree() there is a noop
whereas for TCP it's needed to free closed connections.
Having fewer sofree() makes it easier to understand the code and move
the locks down.
ok visa@
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r-- | sys/net/pfkeyv2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index be092461ada..a68995e6411 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.180 2018/05/19 20:04:55 bluhm Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.181 2018/06/06 06:47:01 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -323,8 +323,9 @@ pfkeyv2_detach(struct socket *so) refcnt_finalize(&kp->refcnt, "pfkeyrefs"); so->so_pcb = NULL; - sofree(so); + KASSERT((so->so_state & SS_NOFDREF) == 0); free(kp, M_PCB, sizeof(struct keycb)); + return (0); } |