Fix a bug that kmem_alloc() is called from the interrupt context.

This commit is contained in:
msaitoh 2012-09-08 02:58:13 +00:00
parent 948320a0e0
commit a3568bcd83
2 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_cprng.c,v 1.11 2012/09/07 02:42:13 tls Exp $ */
/* $NetBSD: subr_cprng.c,v 1.12 2012/09/08 02:58:13 msaitoh Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
#include <sys/cprng.h>
__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.11 2012/09/07 02:42:13 tls Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.12 2012/09/08 02:58:13 msaitoh Exp $");
void
cprng_init(void)
@ -284,7 +284,8 @@ rekeyany:
* If the generator has just been keyed, perform
* the statistical RNG test.
*/
if (__predict_false(c->drbg.reseed_counter == 1)) {
if (__predict_false(c->drbg.reseed_counter == 1) &&
(flags & FASYNC) == 0) {
rngtest_t *rt = kmem_alloc(sizeof(*rt), KM_NOSLEEP);
if (rt) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.247 2012/03/22 20:34:39 drochner Exp $ */
/* $NetBSD: tcp_subr.c,v 1.248 2012/09/08 02:58:13 msaitoh Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.247 2012/03/22 20:34:39 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.248 2012/09/08 02:58:13 msaitoh Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -2214,7 +2214,7 @@ tcp_new_iss1(void *laddr, void *faddr, u_int16_t lport, u_int16_t fport,
*/
if (tcp_iss_gotten_secret == false) {
cprng_strong(kern_cprng,
tcp_iss_secret, sizeof(tcp_iss_secret), 0);
tcp_iss_secret, sizeof(tcp_iss_secret), FASYNC);
tcp_iss_gotten_secret = true;
}