Source-Changes-HG archive

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

[src/trunk]: src/sys/kern - don't trash the linked list pointers in the ksigi...



details:   https://anonhg.NetBSD.org/src/rev/2f9ab7c15f36
branches:  trunk
changeset: 551960:2f9ab7c15f36
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 14 17:39:03 2003 +0000

description:
- don't trash the linked list pointers in the ksiginfo_t reuse case
  [thanks enami]
- fix uninitialized variable in the exit hook.
  [thanks yamt]

diffstat:

 sys/kern/kern_sig.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r bc2fb95db031 -r 2f9ab7c15f36 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Sun Sep 14 17:13:36 2003 +0000
+++ b/sys/kern/kern_sig.c       Sun Sep 14 17:39:03 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.152 2003/09/14 06:59:14 christos Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.153 2003/09/14 17:39:03 christos Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.152 2003/09/14 06:59:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.153 2003/09/14 17:39:03 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -166,8 +166,12 @@
                        return;
                *kpool = *ksi;
                ksiginfo_put(p, kpool);
-       } else
+       } else {
+               ksiginfo_t *next = ksi->ksi_next, *prev = ksi->ksi_prev;
                *kpool = *ksi;
+               kpool->ksi_next = next;
+               kpool->ksi_prev = prev;
+       }
 }
 
 /*
@@ -178,7 +182,7 @@
 {
        ksiginfo_t *ksi, *hp = p->p_sigctx.ps_siginfo;
 
-       if (hp == NULL)
+       if ((ksi = hp) == NULL)
                return;
        for (;;) {
                pool_put(&ksiginfo_pool, ksi);



Home | Main Index | Thread Index | Old Index