Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Replace SIMPLEQ_FOREACH with SIMPLEQ_FOREAC...



details:   https://anonhg.NetBSD.org/src/rev/6363cf1d8f38
branches:  trunk
changeset: 341680:6363cf1d8f38
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Nov 17 10:34:04 2015 +0000

description:
Replace SIMPLEQ_FOREACH with SIMPLEQ_FOREACH_SAFE to prevent use-after-free.

diffstat:

 sys/arch/x86/x86/intr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r bf77b74a91cc -r 6363cf1d8f38 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c   Tue Nov 17 06:44:13 2015 +0000
+++ b/sys/arch/x86/x86/intr.c   Tue Nov 17 10:34:04 2015 +0000
@@ -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 @@
         * 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);



Home | Main Index | Thread Index | Old Index