Fix use-after-free: if m_pullup fails the (freed) mbuf is pushed on the
ip6_pktq queue and re-processed later. Return 1 to say "processed and freed".
This commit is contained in:
parent
0b0687d87e
commit
df4b74a91d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip6_flow.c,v 1.36 2017/12/10 09:06:46 maxv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.36 2017/12/10 09:06:46 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
|
@ -285,12 +285,8 @@ ip6flow_fastforward(struct mbuf **mp)
|
|||
|
||||
if (IP6_HDR_ALIGNED_P(mtod(m, const void *)) == 0) {
|
||||
if ((m = m_copyup(m, sizeof(struct ip6_hdr),
|
||||
(max_linkhdr + 3) & ~3)) == NULL) {
|
||||
goto out;
|
||||
}
|
||||
*mp = m;
|
||||
} else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) {
|
||||
if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
|
||||
(max_linkhdr + 3) & ~3)) == NULL) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
*mp = m;
|
||||
|
|
Loading…
Reference in New Issue