Module Name: src
Committed By: rmind
Date: Fri Jun 6 01:27:32 UTC 2014
Modified Files:
src/sys/net: route.c
Log Message:
rtfree: let's assert for a non-negative reference count and see what happens.
To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/net/route.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.131 src/sys/net/route.c:1.132
--- src/sys/net/route.c:1.131 Fri Jun 6 01:02:47 2014
+++ src/sys/net/route.c Fri Jun 6 01:27:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.131 2014/06/06 01:02:47 rmind Exp $ */
+/* $NetBSD: route.c,v 1.132 2014/06/06 01:27:32 rmind Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
#include "opt_route.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.131 2014/06/06 01:02:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.132 2014/06/06 01:27:32 rmind Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -376,16 +376,13 @@ rtfree(struct rtentry *rt)
{
struct ifaddr *ifa;
- if (rt == NULL)
- panic("rtfree");
+ KASSERT(rt != NULL);
+ KASSERT(rt->rt_refcnt > 0);
+
rt->rt_refcnt--;
- if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_UP) == 0) {
+ if (rt->rt_refcnt == 0 && (rt->rt_flags & RTF_UP) == 0) {
rt_assert_inactive(rt);
rttrash--;
- if (rt->rt_refcnt < 0) {
- printf("rtfree: %p not freed (neg refs)\n", rt);
- return;
- }
rt_timer_remove_all(rt, 0);
ifa = rt->rt_ifa;
rt->rt_ifa = NULL;