tcp: Fix the dangling socket reference in the async sending message
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 16 Nov 2011 01:38:27 +0000 (09:38 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 16 Nov 2011 01:50:49 +0000 (09:50 +0800)
commit939c81e437fba5db85fb9d7fd41b12da3f5e3752
treedb1faa7a1dab72f7df3b439d5a3a4f49e08b68d1
parent3813baa3a4e1aeb63d3f1b1412fdc64c513975ce
tcp: Fix the dangling socket reference in the async sending message

It is possible that tcp input path or tcp timers to drop the socket
reference and put the socket into disconnected state, when there
are still asynchronized sending messages pending on the netisr
message port.  If the user space program choose to close the tcp
socket under this situation, then the socket will be directly
freed on the syscall path since the socket has already been
disconnected, so the pending asynchronized sending messages on the
netisr message port will reference freed socket, thus cause
panic later on.

Fix the problem by explicit "sync" the netisr, which could have
pending asynchronized sending messages, before freeing the socket
on the soclose path.
sys/kern/uipc_socket.c