Date: Mon, 26 Aug 2019 09:29:15 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351507 - stable/12/sys/kern Message-ID: <201908260929.x7Q9TF12031702@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Mon Aug 26 09:29:14 2019 New Revision: 351507 URL: https://svnweb.freebsd.org/changeset/base/351507 Log: MFC r351214: Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose(). PR: 239893 Modified: stable/12/sys/kern/uipc_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Mon Aug 26 08:08:15 2019 (r351506) +++ stable/12/sys/kern/uipc_socket.c Mon Aug 26 09:29:14 2019 (r351507) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908260929.x7Q9TF12031702>