<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/net/handshake, branch v6.6.131</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-11T14:22:02+00:00</updated>
<entry>
<title>net/handshake: restore destructor on submit failure</title>
<updated>2026-01-11T14:22:02+00:00</updated>
<author>
<name>caoping</name>
<email>caoping@cmss.chinamobile.com</email>
</author>
<published>2025-12-04T09:10:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cd8cf2be3717137554744233fda051ffc09d1d44'/>
<id>urn:sha1:cd8cf2be3717137554744233fda051ffc09d1d44</id>
<content type='text'>
commit 6af2a01d65f89e73c1cbb9267f8880d83a88cee4 upstream.

handshake_req_submit() replaces sk-&gt;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")
Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: caoping &lt;caoping@cmss.chinamobile.com&gt;
Link: https://patch.msgid.link/20251204091058.1545151-1-caoping@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: duplicate handshake cancellations leak socket</title>
<updated>2026-01-11T14:21:47+00:00</updated>
<author>
<name>Scott Mayhew</name>
<email>smayhew@redhat.com</email>
</author>
<published>2025-12-09T19:30:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=011ae80c49d9bfa5b4336f8bd387cd25c7593663'/>
<id>urn:sha1:011ae80c49d9bfa5b4336f8bd387cd25c7593663</id>
<content type='text'>
[ Upstream commit 15564bd67e2975002f2a8e9defee33e321d3183f ]

When a handshake request is cancelled it is removed from the
handshake_net-&gt;hn_requests list, but it is still present in the
handshake_rhashtbl until it is destroyed.

If a second cancellation request arrives for the same handshake request,
then remove_pending() will return false... and assuming
HANDSHAKE_F_REQ_COMPLETED isn't set in req-&gt;hr_flags, we'll continue
processing through the out_true label, where we put another reference on
the sock and a refcount underflow occurs.

This can happen for example if a handshake times out - particularly if
the SUNRPC client sends the AUTH_TLS probe to the server but doesn't
follow it up with the ClientHello due to a problem with tlshd.  When the
timeout is hit on the server, the server will send a FIN, which triggers
a cancellation request via xs_reset_transport().  When the timeout is
hit on the client, another cancellation request happens via
xs_tls_handshake_sync().

Add a test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED) in the pending cancel
path so duplicate cancels can be detected.

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Suggested-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Signed-off-by: Scott Mayhew &lt;smayhew@redhat.com&gt;
Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://patch.msgid.link/20251209193015.3032058-1-smayhew@redhat.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: Fix memory leak in tls_handshake_accept()</title>
<updated>2025-11-24T09:29:59+00:00</updated>
<author>
<name>Zilin Guan</name>
<email>zilin@seu.edu.cn</email>
</author>
<published>2025-11-06T14:45:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e9800b8b77f2de710a73494091bcf1482862d871'/>
<id>urn:sha1:e9800b8b77f2de710a73494091bcf1482862d871</id>
<content type='text'>
[ Upstream commit 3072f00bba764082fa41b3c3a2a7b013335353d2 ]

In tls_handshake_accept(), a netlink message is allocated using
genlmsg_new(). In the error handling path, genlmsg_cancel() is called
to cancel the message construction, but the message itself is not freed.
This leads to a memory leak.

Fix this by calling nlmsg_free() in the error path after genlmsg_cancel()
to release the allocated memory.

Fixes: 2fd5532044a89 ("net/handshake: Add a kernel API for requesting a TLSv1.3 handshake")
Signed-off-by: Zilin Guan &lt;zilin@seu.edu.cn&gt;
Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://patch.msgid.link/20251106144511.3859535-1-zilin@seu.edu.cn
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: Fix handshake_req_destroy_test1</title>
<updated>2024-02-23T08:24:50+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>chuck.lever@oracle.com</email>
</author>
<published>2024-02-06T19:16:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d74226e03df1bf19848f18344401f254345af912'/>
<id>urn:sha1:d74226e03df1bf19848f18344401f254345af912</id>
<content type='text'>
[ Upstream commit 4e1d71cabb19ec2586827adfc60d68689c68c194 ]

Recently, handshake_req_destroy_test1 started failing:

Expected handshake_req_destroy_test == req, but
    handshake_req_destroy_test == 0000000000000000
    req == 0000000060f99b40
not ok 11 req_destroy works

This is because "sock_release(sock)" was replaced with "fput(filp)"
to address a memory leak. Note that sock_release() is synchronous
but fput() usually delays the final close and clean-up.

The delay is not consequential in the other cases that were changed
but handshake_req_destroy_test1 is testing that handshake_req_cancel()
followed by closing the file actually does call the -&gt;hp_destroy
method. Thus the PTR_EQ test at the end has to be sure that the
final close is complete before it checks the pointer.

We cannot use a completion here because if -&gt;hp_destroy is never
called (ie, there is an API bug) then the test will hang.

Reported by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Closes: https://lore.kernel.org/netdev/ZcKDd1to4MPANCrn@tissot.1015granger.net/T/#mac5c6299f86799f1c71776f3a07f9c566c7c3c40
Fixes: 4a0f07d71b04 ("net/handshake: Fix memory leak in __sock_create() and sock_alloc_file()")
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Link: https://lore.kernel.org/r/170724699027.91401.7839730697326806733.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: fix file ref count in handshake_nl_accept_doit()</title>
<updated>2023-10-23T17:19:33+00:00</updated>
<author>
<name>Moritz Wanzenböck</name>
<email>moritz.wanzenboeck@linbit.com</email>
</author>
<published>2023-10-19T12:58:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7798b59409c345d4a6034a4326bceb9f7e2e8b58'/>
<id>urn:sha1:7798b59409c345d4a6034a4326bceb9f7e2e8b58</id>
<content type='text'>
If req-&gt;hr_proto-&gt;hp_accept() fail, we call fput() twice:
Once in the error path, but also a second time because sock-&gt;file
is at that point already associated with the file descriptor. Once
the task exits, as it would probably do after receiving an error
reading from netlink, the fd is closed, calling fput() a second time.

To fix, we move installing the file after the error path for the
hp_accept() call. In the case of errors we simply put the unused fd.
In case of success we can use fd_install() to link the sock-&gt;file
to the reserved fd.

Fixes: 7ea9c1ec66bc ("net/handshake: Fix handshake_dup() ref counting")
Signed-off-by: Moritz Wanzenböck &lt;moritz.wanzenboeck@linbit.com&gt;
Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://lore.kernel.org/r/20231019125847.276443-1-moritz.wanzenboeck@linbit.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: Fix memory leak in __sock_create() and sock_alloc_file()</title>
<updated>2023-09-20T10:54:49+00:00</updated>
<author>
<name>Jinjie Ruan</name>
<email>ruanjinjie@huawei.com</email>
</author>
<published>2023-09-19T10:44:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4a0f07d71b0483cc08c03cefa7c85749e187c214'/>
<id>urn:sha1:4a0f07d71b0483cc08c03cefa7c85749e187c214</id>
<content type='text'>
When making CONFIG_DEBUG_KMEMLEAK=y and CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y,
modprobe handshake-test and then rmmmod handshake-test, the below memory
leak is detected.

The struct socket_alloc which is allocated by alloc_inode_sb() in
__sock_create() is not freed. And the struct dentry which is allocated
by __d_alloc() in sock_alloc_file() is not freed.

Since fput() will call file-&gt;f_op-&gt;release() which is sock_close() here and
it will call __sock_release(). and fput() will call dput(dentry) to free
the struct dentry. So replace sock_release() with fput() to fix the
below memory leak. After applying this patch, the following memory leak is
never detected.

unreferenced object 0xffff888109165840 (size 768):
  comm "kunit_try_catch", pid 1852, jiffies 4294685807 (age 976.262s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa0209ba2&gt;] 0xffffffffa0209ba2
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810f472008 (size 192):
  comm "kunit_try_catch", pid 1852, jiffies 4294685808 (age 976.261s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 08 20 47 0f 81 88 ff ff  ......... G.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0209bbb&gt;] 0xffffffffa0209bbb
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810958e580 (size 224):
  comm "kunit_try_catch", pid 1852, jiffies 4294685808 (age 976.261s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0209bbb&gt;] 0xffffffffa0209bbb
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810926dc88 (size 192):
  comm "kunit_try_catch", pid 1854, jiffies 4294685809 (age 976.271s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 88 dc 26 09 81 88 ff ff  ..........&amp;.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208fdc&gt;] 0xffffffffa0208fdc
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810a241380 (size 224):
  comm "kunit_try_catch", pid 1854, jiffies 4294685809 (age 976.271s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208fdc&gt;] 0xffffffffa0208fdc
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888109165040 (size 768):
  comm "kunit_try_catch", pid 1856, jiffies 4294685811 (age 976.269s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa0208860&gt;] 0xffffffffa0208860
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810926d568 (size 192):
  comm "kunit_try_catch", pid 1856, jiffies 4294685811 (age 976.269s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 68 d5 26 09 81 88 ff ff  ........h.&amp;.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208879&gt;] 0xffffffffa0208879
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810a240580 (size 224):
  comm "kunit_try_catch", pid 1856, jiffies 4294685811 (age 976.347s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208879&gt;] 0xffffffffa0208879
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888109164c40 (size 768):
  comm "kunit_try_catch", pid 1858, jiffies 4294685816 (age 976.342s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa0208541&gt;] 0xffffffffa0208541
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810926cd18 (size 192):
  comm "kunit_try_catch", pid 1858, jiffies 4294685816 (age 976.342s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 18 cd 26 09 81 88 ff ff  ..........&amp;.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa020855a&gt;] 0xffffffffa020855a
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810a240200 (size 224):
  comm "kunit_try_catch", pid 1858, jiffies 4294685816 (age 976.342s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa020855a&gt;] 0xffffffffa020855a
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888109164840 (size 768):
  comm "kunit_try_catch", pid 1860, jiffies 4294685817 (age 976.416s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa02093e2&gt;] 0xffffffffa02093e2
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810926cab8 (size 192):
  comm "kunit_try_catch", pid 1860, jiffies 4294685817 (age 976.416s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 b8 ca 26 09 81 88 ff ff  ..........&amp;.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa02093fb&gt;] 0xffffffffa02093fb
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810a240040 (size 224):
  comm "kunit_try_catch", pid 1860, jiffies 4294685817 (age 976.416s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa02093fb&gt;] 0xffffffffa02093fb
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888109166440 (size 768):
  comm "kunit_try_catch", pid 1862, jiffies 4294685819 (age 976.489s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa02097c1&gt;] 0xffffffffa02097c1
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810926c398 (size 192):
  comm "kunit_try_catch", pid 1862, jiffies 4294685819 (age 976.489s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 98 c3 26 09 81 88 ff ff  ..........&amp;.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa02097da&gt;] 0xffffffffa02097da
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888107e0b8c0 (size 224):
  comm "kunit_try_catch", pid 1862, jiffies 4294685819 (age 976.489s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa02097da&gt;] 0xffffffffa02097da
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888109164440 (size 768):
  comm "kunit_try_catch", pid 1864, jiffies 4294685821 (age 976.487s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 5a 5a 20 00 00 00 00 00 00 00  ......ZZ .......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff8397993f&gt;] sock_alloc_inode+0x1f/0x1b0
    [&lt;ffffffff81a2cb5b&gt;] alloc_inode+0x5b/0x1a0
    [&lt;ffffffff81a32bed&gt;] new_inode_pseudo+0xd/0x70
    [&lt;ffffffff8397889c&gt;] sock_alloc+0x3c/0x260
    [&lt;ffffffff83979b46&gt;] __sock_create+0x66/0x3d0
    [&lt;ffffffffa020824e&gt;] 0xffffffffa020824e
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810f4cf698 (size 192):
  comm "kunit_try_catch", pid 1864, jiffies 4294685821 (age 976.501s)
  hex dump (first 32 bytes):
    00 00 50 40 02 00 00 00 00 00 00 00 00 00 00 00  ..P@............
    00 00 00 00 00 00 00 00 98 f6 4c 0f 81 88 ff ff  ..........L.....
  backtrace:
    [&lt;ffffffff81a1ff11&gt;] __d_alloc+0x31/0x8a0
    [&lt;ffffffff81a2910e&gt;] d_alloc_pseudo+0xe/0x50
    [&lt;ffffffff819d549e&gt;] alloc_file_pseudo+0xce/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208267&gt;] 0xffffffffa0208267
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888107e0b000 (size 224):
  comm "kunit_try_catch", pid 1864, jiffies 4294685821 (age 976.501s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 03 00 2e 08 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff819d4b90&gt;] alloc_empty_file+0x50/0x160
    [&lt;ffffffff819d4cf9&gt;] alloc_file+0x59/0x730
    [&lt;ffffffff819d5524&gt;] alloc_file_pseudo+0x154/0x210
    [&lt;ffffffff83978582&gt;] sock_alloc_file+0x42/0x1b0
    [&lt;ffffffffa0208267&gt;] 0xffffffffa0208267
    [&lt;ffffffff829cf03a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81236fc6&gt;] kthread+0x2b6/0x380
    [&lt;ffffffff81096afd&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff81003511&gt;] ret_from_fork_asm+0x11/0x20

Fixes: 88232ec1ec5e ("net/handshake: Add Kunit tests for the handshake consumer API")
Signed-off-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/handshake: fix null-ptr-deref in handshake_nl_done_doit()</title>
<updated>2023-09-01T06:25:14+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-31T08:45:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=82ba0ff7bf0483d962e592017bef659ae022d754'/>
<id>urn:sha1:82ba0ff7bf0483d962e592017bef659ae022d754</id>
<content type='text'>
We should not call trace_handshake_cmd_done_err() if socket lookup has failed.

Also we should call trace_handshake_cmd_done_err() before releasing the file,
otherwise dereferencing sock-&gt;sk can return garbage.

This also reverts 7afc6d0a107f ("net/handshake: Fix uninitialized local variable")

Unable to handle kernel paging request at virtual address dfff800000000003
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
Mem abort info:
ESR = 0x0000000096000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x05: level 1 translation fault
Data abort info:
ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[dfff800000000003] address between user and kernel address ranges
Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 5986 Comm: syz-executor292 Not tainted 6.5.0-rc7-syzkaller-gfe4469582053 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : handshake_nl_done_doit+0x198/0x9c8 net/handshake/netlink.c:193
lr : handshake_nl_done_doit+0x180/0x9c8
sp : ffff800096e37180
x29: ffff800096e37200 x28: 1ffff00012dc6e34 x27: dfff800000000000
x26: ffff800096e373d0 x25: 0000000000000000 x24: 00000000ffffffa8
x23: ffff800096e373f0 x22: 1ffff00012dc6e38 x21: 0000000000000000
x20: ffff800096e371c0 x19: 0000000000000018 x18: 0000000000000000
x17: 0000000000000000 x16: ffff800080516cc4 x15: 0000000000000001
x14: 1fffe0001b14aa3b x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000003
x8 : 0000000000000003 x7 : ffff800080afe47c x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff800080a88078
x2 : 0000000000000001 x1 : 00000000ffffffa8 x0 : 0000000000000000
Call trace:
handshake_nl_done_doit+0x198/0x9c8 net/handshake/netlink.c:193
genl_family_rcv_msg_doit net/netlink/genetlink.c:970 [inline]
genl_family_rcv_msg net/netlink/genetlink.c:1050 [inline]
genl_rcv_msg+0x96c/0xc50 net/netlink/genetlink.c:1067
netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2549
genl_rcv+0x38/0x50 net/netlink/genetlink.c:1078
netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
netlink_unicast+0x660/0x8d4 net/netlink/af_netlink.c:1365
netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1914
sock_sendmsg_nosec net/socket.c:725 [inline]
sock_sendmsg net/socket.c:748 [inline]
____sys_sendmsg+0x56c/0x840 net/socket.c:2494
___sys_sendmsg net/socket.c:2548 [inline]
__sys_sendmsg+0x26c/0x33c net/socket.c:2577
__do_sys_sendmsg net/socket.c:2586 [inline]
__se_sys_sendmsg net/socket.c:2584 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2584
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
el0_svc+0x58/0x16c arch/arm64/kernel/entry-common.c:678
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
Code: 12800108 b90043e8 910062b3 d343fe68 (387b6908)

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Reviewed-by: Michal Kubiak &lt;michal.kubiak@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/handshake: Trace events for TLS Alert helpers</title>
<updated>2023-07-28T21:07:59+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>chuck.lever@oracle.com</email>
</author>
<published>2023-07-27T17:38:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b470985c76df6d53a9454670fb7551e1197f55e2'/>
<id>urn:sha1:b470985c76df6d53a9454670fb7551e1197f55e2</id>
<content type='text'>
Add observability for the new TLS Alert infrastructure.

Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://lore.kernel.org/r/169047947409.5241.14548832149596892717.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: Add helpers for parsing incoming TLS Alerts</title>
<updated>2023-07-28T21:07:59+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>chuck.lever@oracle.com</email>
</author>
<published>2023-07-27T17:37:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=39d0e38dcced8d4da92cd11f3ff618bacc42d8a9'/>
<id>urn:sha1:39d0e38dcced8d4da92cd11f3ff618bacc42d8a9</id>
<content type='text'>
Kernel TLS consumers can replace common TLS Alert parsing code with
these helpers.

Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://lore.kernel.org/r/169047942074.5241.13791647439480672048.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/handshake: Add API for sending TLS Closure alerts</title>
<updated>2023-07-28T21:07:59+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>chuck.lever@oracle.com</email>
</author>
<published>2023-07-27T17:36:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=35b1b538d422fd765d88fbdaaa6e06ee466d9f93'/>
<id>urn:sha1:35b1b538d422fd765d88fbdaaa6e06ee466d9f93</id>
<content type='text'>
This helper sends an alert only if a TLS session was established.

Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Link: https://lore.kernel.org/r/169047936730.5241.618595693821012638.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
