summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2016-06-02 00:34:13 +0000
committerdlg <dlg@openbsd.org>2016-06-02 00:34:13 +0000
commit62133b7f332112c57f2b0c446b2a8d61c9441126 (patch)
treed246cd27e8b8199b25710025beccded26758a259
parentNot all architectures implicitly #include <sys/device.h> via earlier (diff)
downloadwireguard-openbsd-62133b7f332112c57f2b0c446b2a8d61c9441126.tar.xz
wireguard-openbsd-62133b7f332112c57f2b0c446b2a8d61c9441126.zip
always clean up the heap in art_table_delete, even for the last at_refcnt
in the future a table may also be referenced by a cpu reading it with srp as well as the art rtable, so try and make sure it is always usable. ok mpi@
-rw-r--r--sys/net/art.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/art.c b/sys/net/art.c
index 6f54be86e2e..227aaa472c3 100644
--- a/sys/net/art.c
+++ b/sys/net/art.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: art.c,v 1.15 2016/06/01 06:19:06 dlg Exp $ */
+/* $OpenBSD: art.c,v 1.16 2016/06/02 00:34:13 dlg Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -490,10 +490,6 @@ art_table_delete(struct art_root *ar, struct art_table *at, int i,
KASSERT(prev == node);
#endif
- /* We are removing an entry from this table. */
- if (art_table_free(ar, at))
- return (node);
-
/* Get the next most specific route for the index `i'. */
if ((i >> 1) > 1)
next = at->at_heap[i >> 1].node;
@@ -512,6 +508,9 @@ art_table_delete(struct art_root *ar, struct art_table *at, int i,
else
at->at_heap[i].node = next;
+ /* We have removed an entry from this table. */
+ art_table_free(ar, at);
+
return (node);
}