summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkcrowenex <kevin.crowe@nexenta.com>2016-03-31 15:35:58 -0400
committerGordon Ross <gwr@nexenta.com>2019-05-19 19:21:13 -0400
commit41bd85101cd90603ab3220d835461fe851a81fed (patch)
treec1806ebca4df9992ee45cae444c0c7941bbbcc6c
parent9c856e866360bf6877f0e47fdfef22bd8e33cf14 (diff)
downloadillumos-joyent-41bd85101cd90603ab3220d835461fe851a81fed.tar.gz
10969 SMB server listener stops after a SYN-ACK flood
Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Matt Barden <matt.barden@nexenta.com> Approved by: Joshua M. Clulow <josh@sysmgr.org>
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_server.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c
index a2ea75c608..ba049c2e1c 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_server.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_server.c
@@ -1628,8 +1628,24 @@ smb_server_listener(smb_thread_t *thread, void *arg)
DTRACE_PROBE1(so__wait__accept, struct sonode *, ld->ld_so);
- while (ksocket_accept(ld->ld_so, NULL, NULL, &s_so, CRED())
- == 0) {
+ for (;;) {
+ int ret = ksocket_accept(ld->ld_so, NULL, NULL, &s_so, CRED());
+
+ switch (ret) {
+ case 0:
+ break;
+ case ECONNABORTED:
+ continue;
+ case EINTR:
+ case EBADF: /* libfakekernel */
+ goto out;
+ default:
+ cmn_err(CE_WARN,
+ "smb_server_listener: ksocket_accept(%d)",
+ ret);
+ goto out;
+ }
+
DTRACE_PROBE1(so__accept, struct sonode *, s_so);
on = 1;
@@ -1649,6 +1665,7 @@ smb_server_listener(smb_thread_t *thread, void *arg)
*/
smb_server_create_session(ld, s_so);
}
+out:
/* Disconnect all the sessions this listener created. */
smb_llist_enter(&ld->ld_session_list, RW_READER);
session = smb_llist_head(&ld->ld_session_list);