Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys/kern After releasing the resources, make sure ...



details:   https://anonhg.NetBSD.org/src/rev/109bbfe6896b
branches:  pgoyette-compat
changeset: 830617:109bbfe6896b
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Sep 05 22:04:51 2018 +0000

description:
After releasing the resources, make sure we don't retain pointer to them!

diffstat:

 sys/kern/kern_module.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 5f6c95187c13 -r 109bbfe6896b sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Wed Sep 05 21:53:45 2018 +0000
+++ b/sys/kern/kern_module.c    Wed Sep 05 22:04:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $  */
+/*     $NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.18 2018/09/05 09:42:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.19 2018/09/05 22:04:51 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1406,7 +1406,7 @@
                kmem_free(mod->mod_required, mod->mod_arequired *
                    sizeof(module_t));
        if (mod->mod_source == MODULE_SOURCE_KERNEL) {
-               if (mod->mod_arequired != 0) {
+               if (mod->mod_required != NULL) {
                        /*
                         * release "required" resources - will be re-parsed
                         * if the module is re-enabled
@@ -1415,6 +1415,7 @@
                            mod->mod_arequired * sizeof(module_t *));
                        mod->mod_nrequired = 0;
                        mod->mod_arequired = 0;
+                       mod->mod_required = NULL;
                }
                if (load_requires_force)
                        module_require_force(mod);



Home | Main Index | Thread Index | Old Index