Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net rtfree: let's assert for a non-negative reference co...
details: https://anonhg.NetBSD.org/src/rev/74dc78b162e5
branches: trunk
changeset: 329735:74dc78b162e5
user: rmind <rmind%NetBSD.org@localhost>
date: Fri Jun 06 01:27:32 2014 +0000
description:
rtfree: let's assert for a non-negative reference count and see what happens.
diffstat:
sys/net/route.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diffs (39 lines):
diff -r 7770753d1760 -r 74dc78b162e5 sys/net/route.c
--- a/sys/net/route.c Fri Jun 06 01:02:47 2014 +0000
+++ b/sys/net/route.c Fri Jun 06 01:27:32 2014 +0000
@@ -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 @@
{
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;
Home |
Main Index |
Thread Index |
Old Index