diff options
Diffstat (limited to 'sys/netipsec/key.c')
-rw-r--r-- | sys/netipsec/key.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 83377e5..a38bb8d 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -2396,14 +2396,17 @@ key_spddump(so, m, mhp) /* search SPD entry and get buffer size. */ cnt = 0; + SPTREE_LOCK(); for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { LIST_FOREACH(sp, &V_sptree[dir], chain) { cnt++; } } - if (cnt == 0) + if (cnt == 0) { + SPTREE_UNLOCK(); return key_senderror(so, m, ENOENT); + } for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { LIST_FOREACH(sp, &V_sptree[dir], chain) { @@ -2416,6 +2419,7 @@ key_spddump(so, m, mhp) } } + SPTREE_UNLOCK(); m_freem(m); return 0; } |