Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/netipsec Pull up following revision(s) (requested by ...
details: https://anonhg.NetBSD.org/src/rev/22d3bd92479a
branches: netbsd-8
changeset: 851946:22d3bd92479a
user: martin <martin%NetBSD.org@localhost>
date: Sat Aug 25 14:35:21 2018 +0000
description:
Pull up following revision(s) (requested by ozaki-r in ticket #986):
sys/netipsec/key.c: revision 1.257
Don't call key_ismyaddr, which may sleep, in a pserialize read section
Use mutex here instead of pserialize because using mutex is simpler than
using psz+ref, which is another solution, and key_checkspidup isn't called in
any performance-sensitive paths.
diffstat:
sys/netipsec/key.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (50 lines):
diff -r c1cd4e754a80 -r 22d3bd92479a sys/netipsec/key.c
--- a/sys/netipsec/key.c Sat Aug 25 14:33:04 2018 +0000
+++ b/sys/netipsec/key.c Sat Aug 25 14:35:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.163.2.9 2018/04/18 14:06:24 martin Exp $ */
+/* $NetBSD: key.c,v 1.163.2.10 2018/08/25 14:35:21 martin Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.9 2018/04/18 14:06:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.10 2018/08/25 14:35:21 martin Exp $");
/*
* This code is referred to RFC 2367
@@ -3458,7 +3458,6 @@
{
struct secashead *sah;
struct secasvar *sav;
- int s;
/* check address family */
if (saidx->src.sa.sa_family != saidx->dst.sa.sa_family) {
@@ -3467,18 +3466,19 @@
}
/* check all SAD */
- s = pserialize_read_enter();
- SAHLIST_READER_FOREACH(sah) {
+ /* key_ismyaddr may sleep, so use mutex, not pserialize, here. */
+ mutex_enter(&key_sad.lock);
+ SAHLIST_WRITER_FOREACH(sah) {
if (!key_ismyaddr((struct sockaddr *)&sah->saidx.dst))
continue;
sav = key_getsavbyspi(sah, spi);
if (sav != NULL) {
- pserialize_read_exit(s);
KEY_SA_UNREF(&sav);
+ mutex_exit(&key_sad.lock);
return true;
}
}
- pserialize_read_exit(s);
+ mutex_exit(&key_sad.lock);
return false;
}
Home |
Main Index |
Thread Index |
Old Index