diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-12-03 17:18:35 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-12-03 17:18:35 +0000 |
commit | a1d5abe1d502f970a79317fe1811cb26827aeb98 (patch) | |
tree | b634a039939ba6aabb91393d2d2deaca0b87020b /sys/netinet/ip_spd.c | |
parent | 0285b2528a887ede4d0d8e002d48e65c1ad4a315 (diff) |
Add TDB reference counting to ipsp_spd_lookup(). If an output
pointer is passed to the function, it will return a refcounted TDB.
The ref happens when ipsp_spd_inp() copies the pointer from
ipo->ipo_tdb. The caller of ipsp_spd_lookup() has to unref after
using it.
tested by Hrvoje Popovski; OK mvs@ tobhe@
Diffstat (limited to 'sys/netinet/ip_spd.c')
-rw-r--r-- | sys/netinet/ip_spd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index f8fad967149..b1c49b21247 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.107 2021/12/01 12:51:09 bluhm Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.108 2021/12/03 17:18:34 bluhm Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -825,9 +825,10 @@ ipsp_spd_inp(struct mbuf *m, struct inpcb *inp, struct ipsec_policy *ipo, justreturn: if (tdbout != NULL) { - if (ipo != NULL) + if (ipo != NULL) { + tdb_ref(ipo->ipo_tdb); *tdbout = ipo->ipo_tdb; - else + } else *tdbout = NULL; } return 0; |