From bc60490a88fdad4ed4ebb800425223c3bf2129fb Mon Sep 17 00:00:00 2001 From: "Christian S.J. Peron" Date: Sun, 23 Sep 2007 17:50:17 +0000 Subject: [PATCH] Certain consumers of rtalloc like gif(4) and if_stf(4) lookup the route and once they are done with it, call rtfree(). rtfree() should only be used when we are certain we hold the last reference to the route. This bug results in console messages like the following: rtfree: 0xc40f7000 has 1 refs This patch switches the rtfree() to use RTFREE_LOCKED() instead, which should handle the reference counting on the route better. Approved by: re@ (gnn) Reviewed by: bms Reported by: many via net@ and current@ Tested by: many --- sys/net/if_stf.c | 4 ++-- sys/netinet/in_gif.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 2f53c446c5c..dfb9aeade14 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -607,10 +607,10 @@ stf_checkaddr4(sc, in, inifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return -1; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 0; diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index e70a6f8799f..33631058f7c 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -374,10 +374,10 @@ gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 32 * 2;