git: 1f32cef47189 - main - unix: don't call sbrelease() in uipc_detach()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 12 May 2022 18:03:04 UTC
The branch main has been updated by glebius:

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

commit 1f32cef47189403e9e70b1893c731c68b97b964e
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-05-12 18:02:50 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-05-12 18:02:50 +0000

    unix: don't call sbrelease() in uipc_detach()
    
    Since a982ce04428e the socket buffer is already cleared and released in
    unp_dispose() that is called just before uipc_detach().
---
 sys/kern/uipc_usrreq.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 82b291fa835d..db61dba62f1a 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -790,18 +790,6 @@ uipc_detach(struct socket *so)
 	vp = NULL;
 	vplock = NULL;
 
-	SOCK_LOCK(so);
-	if (!SOLISTENING(so)) {
-		/*
-		 * Once the socket is removed from the global lists,
-		 * uipc_ready() will not be able to locate its socket buffer, so
-		 * clear the buffer now.  At this point internalized rights have
-		 * already been disposed of.
-		 */
-		sbrelease(&so->so_rcv, so);
-	}
-	SOCK_UNLOCK(so);
-
 	UNP_LINK_WLOCK();
 	LIST_REMOVE(unp, unp_link);
 	if (unp->unp_gcflag & UNPGC_DEAD)