Date: Tue, 18 May 2021 19:43:50 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b295c5ddcef4 - main - socket: Release cred reference later in sodealloc() Message-ID: <202105181943.14IJho7p051265@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b295c5ddcef4744ef7044d2327b4258b6ad055f0 commit b295c5ddcef4744ef7044d2327b4258b6ad055f0 Author: Lv Yunlong <lylgood@foxmail.com> AuthorDate: 2021-05-18 19:23:15 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-18 19:25:40 +0000 socket: Release cred reference later in sodealloc() We dereference so->so_cred to update the per-uid socket buffer accounting, so the crfree() call must be deferred until after that point. PR: 255869 MFC after: 1 week --- sys/kern/uipc_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ea86f66556ea..2a167eb68a22 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -476,7 +476,6 @@ sodealloc(struct socket *so) #endif hhook_run_socket(so, NULL, HHOOK_SOCKET_CLOSE); - crfree(so->so_cred); khelp_destroy_osd(&so->osd); if (SOLISTENING(so)) { if (so->sol_accept_filter != NULL) @@ -493,6 +492,7 @@ sodealloc(struct socket *so) SOCKBUF_LOCK_DESTROY(&so->so_snd); SOCKBUF_LOCK_DESTROY(&so->so_rcv); } + crfree(so->so_cred); mtx_destroy(&so->so_lock); uma_zfree(socket_zone, so); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105181943.14IJho7p051265>