Module Name: src
Committed By: maxv
Date: Sun Dec 10 09:06:47 UTC 2017
Modified Files:
src/sys/netinet6: ip6_flow.c
Log Message:
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".
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet6/ip6_flow.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet6/ip6_flow.c
diff -u src/sys/netinet6/ip6_flow.c:1.35 src/sys/netinet6/ip6_flow.c:1.36
--- src/sys/netinet6/ip6_flow.c:1.35 Fri Nov 17 07:37:12 2017
+++ src/sys/netinet6/ip6_flow.c Sun Dec 10 09:06:46 2017
@@ -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;