ksmbd: make ksmbd thread names distinct by client IP
Subsystems (3)
PATCH v2 1/1 ksmbd: make ksmbd thread names distinct by client IP
From: Namjae Jeon <[email protected]>
commit 5da92a251e41f824d7e6b4d54d65dcdcfd69fda3 upstream.
This patch makes ksmbd thread names distinct by client IP address.
100943 ? S 0:00 [ksmbd:::ffff:10.177.110.57]
or
101752 ? S 0:00 [ksmbd:10.177.110.57]
Stable-dep-of: 77ffbcac4e56 ("smb: server: fix leak of active_num_conn in ksmbd_tcp_new_connection()")
Stable-dep-of: 97f8d2648ef4 ("smb: server: fix active_num_conn leak on transport allocation failure")
---
v2: Replace verbose [backport ...] description with standard
Stable-dep-of: tags per stable tree convention.
fs/smb/server/transport_tcp.c | 39 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 26 deletions(-)
fs/smb/server/transport_tcp.c +13 -26
@@ -173,17 +173,6 @@ static struct kvec *get_conn_iovec(struct tcp_transport *t, unsigned int nr_segsreturn new_iov; } -static unsigned short ksmbd_tcp_get_port (const struct sockaddr *sa) -{ -switch (sa->sa_family) { -case AF_INET : -return ntohs (((struct sockaddr_in *)sa)->sin_port); -case AF_INET6 : -return ntohs (((struct sockaddr_in6 *)sa)->sin6_port); - } -return 0 ; -} -/** * ksmbd_tcp_new_connection() - create a new tcp session on mount * @client_sk: socket associated with new connection
@@ -195,7 +184,6 @@ static unsigned short ksmbd_tcp_get_port(const struct sockaddr *sa)*/ static int ksmbd_tcp_new_connection (struct socket *client_sk) { -struct sockaddr *csin;int rc =0 ;struct tcp_transport *t;struct task_struct *handler;
@@ -208,27 +196,26 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk)return -ENOMEM ; } - csin =KSMBD_TCP_PEER_SOCKADDR (KSMBD_TRANS (t)->conn); -if (kernel_getpeername (client_sk, csin) <0 ) { -pr_err ("client ip resolution failed\n" ); - rc = -EINVAL ; - goto out_error; - } - +#if IS_ENABLED (CONFIG_IPV6 ) +if (client_sk->sk->sk_family ==AF_INET6 ) + handler =kthread_run (ksmbd_conn_handler_loop, +KSMBD_TRANS (t)->conn,"ksmbd:%pI6c" , + &KSMBD_TRANS (t)->conn->inet6_addr); +else + handler =kthread_run (ksmbd_conn_handler_loop, +KSMBD_TRANS (t)->conn,"ksmbd:%pI4" , + &KSMBD_TRANS (t)->conn->inet_addr); +#else handler =kthread_run (ksmbd_conn_handler_loop, -KSMBD_TRANS (t)->conn, -"ksmbd:%u" , -ksmbd_tcp_get_port (csin)); +KSMBD_TRANS (t)->conn,"ksmbd:%pI4" , + &KSMBD_TRANS (t)->conn->inet_addr); +#endif if (IS_ERR (handler)) {pr_err ("cannot start conn thread\n" ); rc =PTR_ERR (handler);ksmbd_tcp_disconnect (KSMBD_TRANS (t)); }return rc; - -out_error: -free_transport (t); -return rc; }/**
Signature · 1 line
2.43.5
Greg KH
maintainerQuoted 10 lines · Ferry Meng
From: Namjae Jeon <[email protected]>
commit
5da92a251e41f824d7e6b4d54d65dcdcfd69fda3upstream.This patch makes ksmbd thread names distinct by client IP address.
100943 ? S 0:00 [ksmbd:::ffff:10.177.110.57]
or
101752 ? S 0:00 [ksmbd:10.177.110.57]
Quoted 8 lines
Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Steve French <[email protected]>Stable-dep-of:
77ffbcac4e56("smb: server: fix leak ofactive_num_conninksmbd_tcp_new_connection()")
Stable-dep-of:97f8d2648ef4("smb: server: fixactive_num_connleak on transport allocation failure")Signed-off-by Ferry Meng <[email protected]>---
v2: Replace verbose [backport ...] description with standard
Stable-dep-of: tags per stable tree convention.
Why is this needed?
Is this part of a series? If so, what is that series?
confused,
greg k-h