Skip to content

Commit fb2b564

Browse files
Shutdown socket before release
Calling sock_release() directly when worker thread creation fails may leave the socket not properly shut down, potentially causing incomplete resource cleanup. This change adds a call to kernel_sock_shutdown() before releasing the socket, ensuring the connection is properly closed and reducing the risk of resource leaks or abnormal network states. Co-authored-by: Jordan Chiu <[email protected]>
1 parent 0cca527 commit fb2b564

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

http_server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ int http_server_daemon(void *arg)
217217
worker = kthread_run(http_server_worker, socket, KBUILD_MODNAME);
218218
if (IS_ERR(worker)) {
219219
pr_err("can't create more worker process\n");
220+
kernel_sock_shutdown(socket, SHUT_RDWR);
220221
sock_release(socket);
221222
continue;
222223
}

0 commit comments

Comments
 (0)