git: c17418a0ba6e - main - sockets: assert that any protocol with PR_RIGHTS has dom_dispose()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 May 2022 17:55:09 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c17418a0ba6eef8d2070d75844f9ede4ddbc413b commit c17418a0ba6eef8d2070d75844f9ede4ddbc413b Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-05-09 17:42:48 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-05-09 17:42:48 +0000 sockets: assert that any protocol with PR_RIGHTS has dom_dispose() Through the entire history only PF_UNIX has this feature. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35123 --- sys/kern/uipc_socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f33814efd176..029f7c8387ca 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1195,8 +1195,10 @@ sofree(struct socket *so) so->so_dtor(so); VNET_SO_ASSERT(so); - if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL) + if (pr->pr_flags & PR_RIGHTS) { + MPASS(pr->pr_domain->dom_dispose != NULL); (*pr->pr_domain->dom_dispose)(so); + } if (pr->pr_usrreqs->pru_detach != NULL) (*pr->pr_usrreqs->pru_detach)(so); @@ -2989,8 +2991,10 @@ sorflush(struct socket *so) * any unsafe routines (that rely on locks being initialized) on aso. */ pr = so->so_proto; - if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL) + if (pr->pr_flags & PR_RIGHTS) { + MPASS(pr->pr_domain->dom_dispose != NULL); (*pr->pr_domain->dom_dispose)(&aso); + } sbrelease_internal(&aso.so_rcv, so); }