summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2004-02-12 01:48:40 +0000
committergreen <green@FreeBSD.org>2004-02-12 01:48:40 +0000
commit5004ca437d6e34eda61e95f5c8b4c0773b149a6d (patch)
treead2204600e908ce422a2d3b72b6136f19690f5e1 /sys/kern
parentd3ac9e6362fb681e80b72672bba2fb88c344d9e4 (diff)
downloadFreeBSD-src-5004ca437d6e34eda61e95f5c8b4c0773b149a6d.zip
FreeBSD-src-5004ca437d6e34eda61e95f5c8b4c0773b149a6d.tar.gz
Always socantsendmore() before deallocating a socket. This, in turn,
calls selwakeup() if necessary (which it is, if you don't want freed memory hanging around on your td->td_selq). Props to: alfred
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index f06e48b..683bc0d 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -291,6 +291,7 @@ sofree(so)
struct socket *so;
{
struct socket *head = so->so_head;
+ int s;
KASSERT(so->so_count == 0, ("socket %p so_count not 0", so));
@@ -314,6 +315,12 @@ sofree(so)
so->so_state &= ~SS_INCOMP;
so->so_head = NULL;
}
+ so->so_snd.sb_flags |= SB_NOINTR;
+ (void)sblock(&so->so_snd, M_WAITOK);
+ s = splimp();
+ socantsendmore(so);
+ splx(s);
+ sbunlock(&so->so_snd);
sbrelease(&so->so_snd, so);
sorflush(so);
sodealloc(so);
OpenPOWER on IntegriCloud