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 Prevent use after free. Don't free an inte...



details:   https://anonhg.NetBSD.org/src/rev/4a0801bc7eaa
branches:  trunk
changeset: 346040:4a0801bc7eaa
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jun 20 08:14:06 2016 +0000

description:
Prevent use after free.  Don't free an interrupt source still in use.

Ok: Kengo NAKAHARA

diffstat:

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

diffs (30 lines):

diff -r 05f07c67cc65 -r 4a0801bc7eaa sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c   Mon Jun 20 08:12:25 2016 +0000
+++ b/sys/arch/x86/x86/intr.c   Mon Jun 20 08:14:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.91 2015/11/17 10:34:04 hannken Exp $        */
+/*     $NetBSD: intr.c,v 1.92 2016/06/20 08:14:06 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.91 2015/11/17 10:34:04 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.92 2016/06/20 08:14:06 hannken Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -612,6 +612,11 @@
                return;
        }
 
+       /* If the interrupt uses shared IRQ, don't free yet. */
+       if (isp->is_handlers != NULL) {
+               return;
+       }
+
        intr_free_io_intrsource_direct(isp);
 }
 



Home | Main Index | Thread Index | Old Index