From 82295697cd4bae93852c3a10a939f20227018fbd Mon Sep 17 00:00:00 2001 From: rwatson Date: Sat, 12 Jun 2004 20:47:32 +0000 Subject: Extend coverage of SOCK_LOCK(so) to include so_count, the socket reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS --- sys/netatm/atm_socket.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/netatm/atm_socket.c') diff --git a/sys/netatm/atm_socket.c b/sys/netatm/atm_socket.c index 1c98961..6a027e2 100644 --- a/sys/netatm/atm_socket.c +++ b/sys/netatm/atm_socket.c @@ -173,6 +173,7 @@ atm_sock_detach(so) /* * Break links and free control blocks */ + SOCK_LOCK(so); so->so_pcb = NULL; sotryfree(so); -- cgit v1.1