summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarios Makassikis <mmakassikis@freebox.fr>2021-07-23 12:58:41 +0900
committerNamjae Jeon <namjae.jeon@samsung.com>2021-07-23 13:10:55 +0900
commit654c8876f93677915b1a009bc7f2421ab8750bf1 (patch)
tree5f2de3d05b8e1e7bb290a5e576bad39815ffa155
parent378087cd17eea71c4e78e6053597e38429ccee0f (diff)
ksmbd: Fix potential memory leak in tcp_destroy_socket()
ksmbd_socket must be freed even if kernel_sock_shutdown() somehow fails. Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/ksmbd/transport_tcp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c
index 56ec11ff5a9f..dc15a5ecd2e0 100644
--- a/fs/ksmbd/transport_tcp.c
+++ b/fs/ksmbd/transport_tcp.c
@@ -381,8 +381,7 @@ static void tcp_destroy_socket(struct socket *ksmbd_socket)
ret = kernel_sock_shutdown(ksmbd_socket, SHUT_RDWR);
if (ret)
pr_err("Failed to shutdown socket: %d\n", ret);
- else
- sock_release(ksmbd_socket);
+ sock_release(ksmbd_socket);
}
/**