m_cat may free mbuf on 2nd arg, so m_pkthdr manipulation has to happen

before m_cat call.  from Julian Coleman via kame.
This commit is contained in:
itojun 2003-08-06 14:47:32 +00:00
parent 4b276b6083
commit 256877974a
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ah_input.c,v 1.40 2003/07/22 11:18:25 itojun Exp $ */
/* $NetBSD: ah_input.c,v 1.41 2003/08/06 14:47:32 itojun Exp $ */
/* $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.40 2003/07/22 11:18:25 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.41 2003/08/06 14:47:32 itojun Exp $");
#include "opt_inet.h"
@ -458,9 +458,9 @@ ah4_input(m, va_alist)
goto fail;
}
m_adj(n, stripsiz);
m_cat(m, n);
/* m_cat does not update m_pkthdr.len */
m->m_pkthdr.len += n->m_pkthdr.len;
m_cat(m, n);
}
if (m->m_len < sizeof(*ip)) {
@ -895,9 +895,9 @@ ah6_input(mp, offp, proto)
goto fail;
}
m_adj(n, stripsiz);
m_cat(m, n);
/* m_cat does not update m_pkthdr.len */
m->m_pkthdr.len += n->m_pkthdr.len;
m_cat(m, n);
}
ip6 = mtod(m, struct ip6_hdr *);
/* XXX jumbogram */

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_input.c,v 1.32 2003/07/22 11:18:25 itojun Exp $ */
/* $NetBSD: esp_input.c,v 1.33 2003/08/06 14:47:32 itojun Exp $ */
/* $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.32 2003/07/22 11:18:25 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.33 2003/08/06 14:47:32 itojun Exp $");
#include "opt_inet.h"
@ -834,9 +834,9 @@ noreplaycheck:
goto bad;
}
m_adj(n, stripsiz);
m_cat(m, n);
/* m_cat does not update m_pkthdr.len */
m->m_pkthdr.len += n->m_pkthdr.len;
m_cat(m, n);
}
ip6 = mtod(m, struct ip6_hdr *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.c,v 1.94 2003/06/24 07:54:47 itojun Exp $ */
/* $NetBSD: icmp6.c,v 1.95 2003/08/06 14:47:32 itojun Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.94 2003/06/24 07:54:47 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.95 2003/08/06 14:47:32 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -2620,8 +2620,8 @@ icmp6_redirect_output(m0, rt)
m->m_pkthdr.len = m->m_len = p - (u_char *)ip6;
/* connect m0 to m */
m_cat(m, m0);
m->m_pkthdr.len += m0->m_pkthdr.len;
m_cat(m, m0);
m0 = NULL;
}
noredhdropt: