git: cb7bb946f7ac - stable/13 - rpc: Convert an SOLISTENING check to an assertion

Mark Johnston markj at FreeBSD.org
Fri Sep 24 13:32:09 UTC 2021


The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb7bb946f7ac6e9c1a42e028981fa1333ada3664

commit cb7bb946f7ac6e9c1a42e028981fa1333ada3664
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-09-17 16:13:02 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-09-24 13:01:07 +0000

    rpc: Convert an SOLISTENING check to an assertion
    
    Per the comment, this socket should always be a listening socket.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 7fabaac2211e7ed1cec9650e46f4e03428411dcf)
---
 sys/rpc/svc_vc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c
index d81c0b01d84d..77452d906594 100644
--- a/sys/rpc/svc_vc.c
+++ b/sys/rpc/svc_vc.c
@@ -328,11 +328,9 @@ svc_vc_accept(struct socket *head, struct socket **sop)
 	int error = 0;
 	short nbio;
 
-	/* XXXGL: shouldn't that be an assertion? */
-	if (!SOLISTENING(head)) {
-		error = EINVAL;
-		goto done;
-	}
+	KASSERT(SOLISTENING(head),
+	    ("%s: socket %p is not listening", __func__, head));
+
 #ifdef MAC
 	error = mac_socket_check_accept(curthread->td_ucred, head);
 	if (error != 0)


More information about the dev-commits-src-all mailing list