kern/112490: [route] [patch] Problem in "rt_check" routine.

John Baldwin john at baldwin.cx
Mon Oct 15 15:30:04 PDT 2007


The following reply was made to PR kern/112490; it has been noted by GNATS.

From: John Baldwin <john at baldwin.cx>
To: bug-followup at freebsd.org, mehuljv at yahoo.com
Cc:  
Subject: Re: kern/112490: [route] [patch] Problem in "rt_check" routine.
Date: Mon, 15 Oct 2007 16:20:09 -0400

 ru@ pointed out a problem in my earlier patch that could result in some double 
 frees.  Here is an update:
 
 Index: route.c
 ===================================================================
 RCS file: /usr/cvs/src/sys/net/route.c,v
 retrieving revision 1.120
 diff -u -r1.120 route.c
 --- route.c	11 Jun 2007 12:19:34 -0000	1.120
 +++ route.c	15 Oct 2007 19:50:53 -0000
 @@ -1304,6 +1304,7 @@
  		if ((rt->rt_flags & RTF_UP) == 0) {
  			RTFREE_LOCKED(rt);	/* unlock gwroute */
  			rt = rt0;
 +			rt->rt_gwroute = NULL;
  		lookup:
  			RT_UNLOCK(rt0);
  			rt = rtalloc1(rt->rt_gateway, 1, 0UL);
 @@ -1314,6 +1315,8 @@
  				return (ENETUNREACH);
  			}
  			RT_LOCK(rt0);
 +			if (rt0->rt_gwroute != NULL)
 +				RTFREE(rt0->rt_gwroute);
  			rt0->rt_gwroute = rt;
  			if (rt == NULL) {
  				RT_UNLOCK(rt0);
 
 -- 
 John Baldwin


More information about the freebsd-bugs mailing list