Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose().

PR:		239893
MFC after:	1 week
This commit is contained in:
ae 2019-08-19 12:42:03 +00:00
parent 6261923e4c
commit 700a658772

View File

@ -1131,9 +1131,9 @@ drop:
so->so_state |= SS_NOFDREF;
sorele(so);
if (listening) {
struct socket *sp;
struct socket *sp, *tsp;
TAILQ_FOREACH(sp, &lqueue, so_list) {
TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) {
SOCK_LOCK(sp);
if (sp->so_count == 0) {
SOCK_UNLOCK(sp);