From af9e3184f811e71722c267e0b17b7c1798932634 Mon Sep 17 00:00:00 2001 From: yamt Date: Mon, 5 Sep 2005 21:52:38 +0000 Subject: [PATCH] prevent sa_setconcurrency before sa_enable, rather than crashing. (savp_lwp is still null at that point.) noted by skrueger at meinberlikomm.de. --- sys/kern/kern_sa.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_sa.c b/sys/kern/kern_sa.c index 7e74b7a2eed0..d8aabe693330 100644 --- a/sys/kern/kern_sa.c +++ b/sys/kern/kern_sa.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sa.c,v 1.63 2005/08/19 02:04:03 christos Exp $ */ +/* $NetBSD: kern_sa.c,v 1.64 2005/09/05 21:52:38 yamt Exp $ */ /*- * Copyright (c) 2001, 2004, 2005 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sa.c,v 1.63 2005/08/19 02:04:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sa.c,v 1.64 2005/09/05 21:52:38 yamt Exp $"); #include #include @@ -553,6 +553,9 @@ sys_sa_setconcurrency(struct lwp *l, void *v, register_t *retval) if (sa == NULL) return (EINVAL); + if ((l->l_proc->p_flag & P_SA) == 0) + return (EINVAL); + if (SCARG(uap, concurrency) < 1) return (EINVAL);