svn commit: r190614 - user/piso/sys/netinet

Paolo Pisati piso at FreeBSD.org
Wed Apr 1 03:58:50 PDT 2009


Author: piso
Date: Wed Apr  1 10:58:50 2009
New Revision: 190614
URL: http://svn.freebsd.org/changeset/base/190614

Log:
  -avoid a double free
  -remove a redundant variable

Modified:
  user/piso/sys/netinet/ip_fw2.c

Modified: user/piso/sys/netinet/ip_fw2.c
==============================================================================
--- user/piso/sys/netinet/ip_fw2.c	Wed Apr  1 09:37:00 2009	(r190613)
+++ user/piso/sys/netinet/ip_fw2.c	Wed Apr  1 10:58:50 2009	(r190614)
@@ -3385,8 +3385,6 @@ check_body:
 				f->bcnt += pktlen;
 				ip_off = (args->eh != NULL) ? ntohs(ip->ip_off) : ip->ip_off;
 				if (ip_off & (IP_MF | IP_OFFMASK)) {
-					struct mbuf *reass;
-
 					/* 
 					 * ip_reass() expects len & off in host
 					 * byte order: fix them in case we come
@@ -3397,7 +3395,8 @@ check_body:
 						ip->ip_off = ntohs(ip->ip_off);
 					}
 
-					reass = ip_reass(m);
+					m = ip_reass(m);
+					args->m = m;
 					
 					/*
 					 * IP header checksum fixup after 
@@ -3407,8 +3406,7 @@ check_body:
 					if (reass != NULL) {
 						int hlen;
 					
-						args->m = reass;	
-						ip = mtod(args->m, struct ip *);
+						ip = mtod(m, struct ip *);
 						hlen = ip->ip_hl << 2;
 						/* revert len & off for layer2 pkts */
 						if (args->eh != NULL)
@@ -3417,12 +3415,11 @@ check_body:
 						if (hlen == sizeof(struct ip))
 							ip->ip_sum = in_cksum_hdr(ip);
 						else
-							ip->ip_sum = in_cksum(args->m, hlen);
+							ip->ip_sum = in_cksum(m, hlen);
 						retval = IP_FW_REASS;
 						args->rule = f;
 						goto done;
 					} else {
-						/* XXX mbuf double free? */
 						retval = IP_FW_DENY;
 						goto done;
 					}


More information about the svn-src-user mailing list