mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 01:43:18 +00:00
smb: server: fix leak of active_num_conn in ksmbd_tcp_new_connection()
On kthread_run() failure in ksmbd_tcp_new_connection(), the transport is
freed via free_transport(), which does not decrement active_num_conn,
leaking this counter.
Replace free_transport() with ksmbd_tcp_disconnect().
Fixes: 0d0d4680db ("ksmbd: add max connections parameter")
Cc: [email protected]
Signed-off-by: Henrique Carvalho <[email protected]>
Acked-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
This commit is contained in:
committed by
Steve French
parent
b38f99c121
commit
77ffbcac4e
@@ -40,6 +40,7 @@ static const struct ksmbd_transport_ops ksmbd_tcp_transport_ops;
|
||||
|
||||
static void tcp_stop_kthread(struct task_struct *kthread);
|
||||
static struct interface *alloc_iface(char *ifname);
|
||||
static void ksmbd_tcp_disconnect(struct ksmbd_transport *t);
|
||||
|
||||
#define KSMBD_TRANS(t) (&(t)->transport)
|
||||
#define TCP_TRANS(t) ((struct tcp_transport *)container_of(t, \
|
||||
@@ -202,7 +203,7 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk)
|
||||
if (IS_ERR(handler)) {
|
||||
pr_err("cannot start conn thread\n");
|
||||
rc = PTR_ERR(handler);
|
||||
free_transport(t);
|
||||
ksmbd_tcp_disconnect(KSMBD_TRANS(t));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user