sys/netinet6/in6_rmx.c: fix a double-free bug

Hiroki Sato hrs at allbsd.org
Tue Dec 28 02:41:09 PST 2004


Hi,

 Here is a patch from KAME to fix a double-free bug when
 net.inet[6].ip[6].rtexpire=0.

Fix a double-free bug when net.inet[6].ip[6].rtexpire=0.

Obtained from:	KAME (via FreeBSD, in6_rmx.c:1.1.2.3->1.1.2.4)

Index: in6_rmx.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6_rmx.c,v
retrieving revision 1.8
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.8 in6_rmx.c
--- in6_rmx.c	21 Dec 2004 02:54:47 -0000	1.8
+++ in6_rmx.c	28 Dec 2004 09:59:36 -0000
@@ -276,10 +276,16 @@
 		rt->rt_flags |= RTPRF_OURS;
 		rt->rt_rmx.rmx_expire = time_second + rtq_reallyold;
 	} else {
+		struct rtentry *dummy;
+
+		/*
+		 * rtrequest() would recursively call rtfree() without the
+		 * dummy entry argument, causing duplicated free.
+		 */
 		rtrequest(RTM_DELETE,
 			  (struct sockaddr *)rt_key(rt),
 			  rt->rt_gateway, rt_mask(rt),
-			  rt->rt_flags, 0);
+			  rt->rt_flags, &dummy);
 	}
 }
 
Attachment:
pgp00021.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00021.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20041228/614d69b8/attachment-0018.obj>


More information about the Submit mailing list