Module Name: src Committed By: hannken Date: Tue Nov 17 10:34:04 UTC 2015
Modified Files: src/sys/arch/x86/x86: intr.c Log Message: Replace SIMPLEQ_FOREACH with SIMPLEQ_FOREACH_SAFE to prevent use-after-free. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/x86/x86/intr.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/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.90 src/sys/arch/x86/x86/intr.c:1.91 --- src/sys/arch/x86/x86/intr.c:1.90 Fri Oct 9 13:03:55 2015 +++ src/sys/arch/x86/x86/intr.c Tue Nov 17 10:34:04 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.90 2015/10/09 13:03:55 knakahara Exp $ */ +/* $NetBSD: intr.c,v 1.91 2015/11/17 10:34:04 hannken Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.90 2015/10/09 13:03:55 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.91 2015/11/17 10:34:04 hannken Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -1013,9 +1013,10 @@ intr_establish_xname(int legacy_irq, str * device's pci_intr_alloc() or this function. */ if (source->is_handlers != NULL) { - struct intrsource *isp; + struct intrsource *isp, *nisp; - SIMPLEQ_FOREACH(isp, &io_interrupt_sources, is_list) { + SIMPLEQ_FOREACH_SAFE(isp, &io_interrupt_sources, + is_list, nisp) { if (strncmp(intrstr, isp->is_intrid, INTRIDBUF - 1) == 0 && isp->is_handlers == NULL) intr_free_io_intrsource_direct(isp);