Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Fix use-after-free: if m_pullup fails the (free...
details: https://anonhg.NetBSD.org/src/rev/3bb87e2ae6a2
branches: trunk
changeset: 358068:3bb87e2ae6a2
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Dec 10 09:06:46 2017 +0000
description:
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".
diffstat:
sys/netinet6/ip6_flow.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diffs (33 lines):
diff -r f1583f3964dd -r 3bb87e2ae6a2 sys/netinet6/ip6_flow.c
--- a/sys/netinet6/ip6_flow.c Sun Dec 10 08:56:23 2017 +0000
+++ b/sys/netinet6/ip6_flow.c Sun Dec 10 09:06:46 2017 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index