Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Our error paths can call veriexec_file_free(), whic...



details:   https://anonhg.NetBSD.org/src/rev/fe44dd9102ac
branches:  trunk
changeset: 750362:fe44dd9102ac
user:      elad <elad%NetBSD.org@localhost>
date:      Mon Dec 28 02:35:20 2009 +0000

description:
Our error paths can call veriexec_file_free(), whicn in turn will try to
rw_destroy() the vfe lock. The easiest way to fix it for now is simply to
initialize the lock right after allocating the vfe...

diffstat:

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

diffs (35 lines):

diff -r 95ac932c6ccb -r fe44dd9102ac sys/kern/kern_verifiedexec.c
--- a/sys/kern/kern_verifiedexec.c      Sun Dec 27 21:42:22 2009 +0000
+++ b/sys/kern/kern_verifiedexec.c      Mon Dec 28 02:35:20 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_verifiedexec.c,v 1.119 2009/12/25 22:57:54 elad Exp $     */
+/*     $NetBSD: kern_verifiedexec.c,v 1.120 2009/12/28 02:35:20 elad Exp $     */
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.119 2009/12/25 22:57:54 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.120 2009/12/28 02:35:20 elad Exp $");
 
 #include "opt_veriexec.h"
 
@@ -1168,6 +1168,8 @@
 
        vfe = kmem_zalloc(sizeof(*vfe), KM_SLEEP);
 
+       rw_init(&vfe->lock);
+
        /* Lookup fingerprint hashing algorithm. */
        fp_type = prop_string_cstring_nocopy(prop_dictionary_get(dict,
            "fp-type"));
@@ -1256,7 +1258,6 @@
        vfe->page_fp_status = PAGE_FP_NONE;
        vfe->npages = 0;
        vfe->last_page_size = 0;
-       rw_init(&vfe->lock);
 
        vte = veriexec_table_lookup(vp->v_mount);
        if (vte == NULL)



Home | Main Index | Thread Index | Old Index