All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net/handshake: restore destructor on submit failure
@ 2025-12-04  8:47 caoping
  2025-12-04  8:51 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: caoping @ 2025-12-04  8:47 UTC (permalink / raw)
  To: chuck.lever
  Cc: davem, edumazet, kuba, pabeni, horms, kernel-tls-handshake,
	netdev, linux-kernel, stable, caoping

handshake_req_submit() replaces sk->sk_destruct but never restores it when
submission fails before the request is hashed. handshake_sk_destruct() then
returns early and the original destructor never runs, leaking the socket.
Restore sk_destruct on the error path.

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")

Signed-off-by: caoping <caoping@cmss.chinamobile.com>
---
 net/handshake/request.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/handshake/request.c b/net/handshake/request.c
index 274d2c89b6b2..89435ed755cd 100644
--- a/net/handshake/request.c
+++ b/net/handshake/request.c
@@ -276,6 +276,8 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,
 out_unlock:
 	spin_unlock(&hn->hn_lock);
 out_err:
+	/* Restore original destructor so socket teardown still runs on failure */
+	req->hr_sk->sk_destruct = req->hr_odestruct;
 	trace_handshake_submit_err(net, req, req->hr_sk, ret);
 	handshake_req_destroy(req);
 	return ret;

base-commit: 4a26e7032d7d57c998598c08a034872d6f0d3945
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] net/handshake: restore destructor on submit failure
  2025-12-04  8:47 [PATCH v2] net/handshake: restore destructor on submit failure caoping
@ 2025-12-04  8:51 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-12-04  8:51 UTC (permalink / raw)
  To: caoping; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH v2] net/handshake: restore destructor on submit failure
Link: https://lore.kernel.org/stable/20251204084757.1536523-1-caoping%40cmss.chinamobile.com

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-04  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04  8:47 [PATCH v2] net/handshake: restore destructor on submit failure caoping
2025-12-04  8:51 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.