Skip to content

Commit 98a5fd3

Browse files
Joshua Rogerssmfrench
authored andcommitted
ksmbd: close accepted socket when per-IP limit rejects connection
When the per-IP connection limit is exceeded in ksmbd_kthread_fn(), the code sets ret = -EAGAIN and continues the accept loop without closing the just-accepted socket. That leaks one socket per rejected attempt from a single IP and enables a trivial remote DoS. Release client_sk before continuing. This bug was found with ZeroPath. Cc: stable@vger.kernel.org Signed-off-by: Joshua Rogers <linux@joshua.hu> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent e904d81 commit 98a5fd3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/smb/server/transport_tcp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,11 @@ static int ksmbd_kthread_fn(void *p)
290290
}
291291
}
292292
up_read(&conn_list_lock);
293-
if (ret == -EAGAIN)
293+
if (ret == -EAGAIN) {
294+
/* Per-IP limit hit: release the just-accepted socket. */
295+
sock_release(client_sk);
294296
continue;
297+
}
295298

296299
skip_max_ip_conns_limit:
297300
if (server_conf.max_connections &&

0 commit comments

Comments
 (0)