Fix leaking MAC labels for IPv6 inpcbs by adding missing MAC label

destroy call; this transpired because the inpcb alloc path for IPv4/IPv6
is the same code, but IPv6 has a separate free path.  The results was
that as new IPv6 TCP connections were created, kernel memory would
gradually leak.

MFC after:	3 days
Reported by:	tanyong <tanyong at ercist dot iscas dot ac dot cn>,
		zhouzhouyi
This commit is contained in:
rwatson 2007-12-17 17:20:57 +00:00
parent 9d2bf43707
commit 4a0d85f1d4

View File

@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -106,6 +107,8 @@ __FBSDID("$FreeBSD$");
#include <netipsec/key.h>
#endif /* IPSEC */
#include <security/mac/mac_framework.h>
struct in6_addr zeroin6_addr;
int
@ -434,6 +437,9 @@ in6_pcbfree(struct inpcb *inp)
if (inp->inp_moptions != NULL)
inp_freemoptions(inp->inp_moptions);
inp->inp_vflag = 0;
#ifdef MAC
mac_inpcb_destroy(inp);
#endif
INP_UNLOCK(inp);
uma_zfree(ipi->ipi_zone, inp);
}