0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git/ synced 2025-10-06 03:02:55 +02:00
Files
openwrt/target/linux/generic/hack-6.6/941-Revert-ksmbd-limit-repeated-connections-from-clients.patch
Andrea Pesaresi 18bdeda011 kernel: ksmbd: revert upstream limit repeated connection
The upstream commit https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/smb?h=linux-6.6.y&id=fa1c47af4ff641cf9197ecdb1f8240cbb30389c1
and the extended for ipv6 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/smb?h=linux-6.6.y&id=d9e157fcfebc126cd19b2333a6417a840c24e529
cause a regression if you try to get a connection on nautilus by a double click on share name.
When you do a double click on share name Nautilus try to connect two times, and ksmbd refusing it.
An issue is opened here https://github.com/namjaejeon/ksmbd/issues/512, at the moment, until we don't have a fix upstream I suggest to revert these two commits.

Signed-off-by: Andrea Pesaresi <andreapesaresi82@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20192
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-10-05 00:17:02 +02:00

63 lines
1.9 KiB
Diff

From 7fe1a46e2d0bf2f4ca9da286be95c46c21111c0c Mon Sep 17 00:00:00 2001
From: Andrea Pesaresi <andreapesaresi82@gmail.com>
Date: Tue, 30 Sep 2025 22:44:36 +0200
Subject: Revert "ksmbd: limit repeated connections from clients with the same
IP"
This reverts commit fa1c47af4ff641cf9197ecdb1f8240cbb30389c1.
---
fs/smb/server/connection.h | 1 -
fs/smb/server/transport_tcp.c | 17 -----------------
2 files changed, 18 deletions(-)
--- a/fs/smb/server/connection.h
+++ b/fs/smb/server/connection.h
@@ -46,7 +46,6 @@ struct ksmbd_conn {
struct mutex srv_mutex;
int status;
unsigned int cli_cap;
- __be32 inet_addr;
char *request_buf;
struct ksmbd_transport *transport;
struct nls_table *local_nls;
--- a/fs/smb/server/transport_tcp.c
+++ b/fs/smb/server/transport_tcp.c
@@ -87,7 +87,6 @@ static struct tcp_transport *alloc_trans
return NULL;
}
- conn->inet_addr = inet_sk(client_sk->sk)->inet_daddr;
conn->transport = KSMBD_TRANS(t);
KSMBD_TRANS(t)->conn = conn;
KSMBD_TRANS(t)->ops = &ksmbd_tcp_transport_ops;
@@ -231,8 +230,6 @@ static int ksmbd_kthread_fn(void *p)
{
struct socket *client_sk = NULL;
struct interface *iface = (struct interface *)p;
- struct inet_sock *csk_inet;
- struct ksmbd_conn *conn;
int ret;
while (!kthread_should_stop()) {
@@ -251,20 +248,6 @@ static int ksmbd_kthread_fn(void *p)
continue;
}
- /*
- * Limits repeated connections from clients with the same IP.
- */
- csk_inet = inet_sk(client_sk->sk);
- down_read(&conn_list_lock);
- list_for_each_entry(conn, &conn_list, conns_list)
- if (csk_inet->inet_daddr == conn->inet_addr) {
- ret = -EAGAIN;
- break;
- }
- up_read(&conn_list_lock);
- if (ret == -EAGAIN)
- continue;
-
if (server_conf.max_connections &&
atomic_inc_return(&active_num_conn) >= server_conf.max_connections) {
pr_info_ratelimited("Limit the maximum number of connections(%u)\n",