linux/net
Chuck Lever 7f97805b8d net/handshake: Fix handshake_req_destroy_test1
[ Upstream commit 4e1d71cabb ]

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 ->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 ->hp_destroy is never
called (ie, there is an API bug) then the test will hang.

Reported by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/netdev/ZcKDd1to4MPANCrn@tissot.1015granger.net/T/#mac5c6299f86799f1c71776f3a07f9c566c7c3c40
Fixes: 4a0f07d71b ("net/handshake: Fix memory leak in __sock_create() and sock_alloc_file()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/170724699027.91401.7839730697326806733.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-02-23 09:51:24 +01:00
..
6lowpan 6lowpan: Remove redundant initialisation. 2023-03-29 08:22:52 +01:00
9p net: 9p: avoid freeing uninit memory in p9pdu_vreadf 2023-12-13 05:44:30 +09:00
802 net: fill in MODULE_DESCRIPTION()s under net/802* 2023-10-28 11:29:28 +01:00
8021q vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING 2024-01-31 16:21:05 -08:00
appletalk appletalk: Fix Use-After-Free in atalk_ioctl 2023-12-14 12:02:45 +01:00
atm atm: Fix Use-After-Free in do_vcc_ioctl 2023-12-12 13:14:08 +01:00
ax25 net: implement lockless SO_PRIORITY 2023-10-01 19:09:54 +01:00
batman-adv Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-08-24 10:51:39 -07:00
bluetooth Bluetooth: L2CAP: Fix possible multiple reject send 2024-02-05 20:16:56 +00:00
bpf bpf: Fix a few selftest failures due to llvm18 change 2024-02-05 20:16:51 +00:00
bpfilter net: Use umd_cleanup_helper() 2023-05-31 13:06:57 +02:00
bridge bridge: mcast: fix disabled snooping after long uptime 2024-02-05 20:17:09 +00:00
caif sock: Remove ->sendpage*() in favour of sendmsg(MSG_SPLICE_PAGES) 2023-06-24 15:50:13 -07:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-12 17:07:34 -07:00
ceph libceph: just wait for more data to be available on the socket 2024-02-16 19:14:26 +01:00
core net: Fix from address in memcpy_to_iter_csum() 2024-02-16 19:14:32 +01:00
dcb net: dcb: choose correct policy to parse DCB_ATTR_BCN 2023-08-01 21:07:46 -07:00
dccp dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses. 2023-11-02 12:56:03 +01:00
devlink devlink: avoid potential loop in devlink_rel_nested_in_notify_work() 2024-02-16 19:14:23 +01:00
dns_resolver keys, dns: Fix size check of V1 server-list header 2024-01-25 15:44:44 -08:00
dsa net: dsa: fix netdev_priv() dereference before check on non-DSA netdevice events 2024-01-25 15:45:26 -08:00
ethernet net: ethernet: use sysfs_emit() to instead of scnprintf() 2022-12-07 20:02:44 -08:00
ethtool ethtool: netlink: Add missing ethnl_ops_begin/complete 2024-01-25 15:45:30 -08:00
handshake net/handshake: Fix handshake_req_destroy_test1 2024-02-23 09:51:24 +01:00
hsr hsr: Prevent use after free in prp_create_tagged_frame() 2023-11-01 22:26:04 -07:00
ieee802154 sysctl-6.6-rc1 2023-08-29 17:39:15 -07:00
ife net: sched: ife: fix potential use-after-free 2023-12-15 10:50:18 +00:00
ipv4 inet: read sk->sk_family once in inet_recv_error() 2024-02-16 19:14:22 +01:00
ipv6 ipv6: Ensure natural alignment of const ipv6 loopback and router addresses 2024-02-05 20:17:09 +00:00
iucv s390: use control register bit defines 2023-09-19 13:26:57 +02:00
kcm net: kcm: fix direct access to bv_len 2024-02-05 20:16:56 +00:00
key Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-08-18 12:44:56 -07:00
l2tp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
l3mdev l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using netdev_master_upper_dev_get_rcu 2022-04-15 14:27:24 -07:00
lapb net: lapb: Use list_for_each_entry() to simplify code in lapb_iface.c 2021-06-08 16:31:25 -07:00
llc llc: call sock_orphan() at release time 2024-02-05 20:17:09 +00:00
mac80211 wifi: mac80211: fix waiting for beacons logic 2024-02-16 19:14:20 +01:00
mac802154 Core WPAN changes: 2023-06-24 15:41:46 -07:00
mctp mctp: perform route lookups under a RCU read-side lock 2023-10-10 19:43:22 -07:00
mpls networking: Update to register_net_sysctl_sz 2023-08-15 15:26:18 -07:00
mptcp mptcp: relax check on MPC passive fallback 2024-01-25 15:45:29 -08:00
ncsi net/ncsi: Fix netlink major/minor version numbers 2024-01-25 15:44:45 -08:00
netfilter work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:51:20 +01:00
netlabel calipso: fix memory leak in netlbl_calipso_add_pass() 2024-01-25 15:44:39 -08:00
netlink netlink: fix potential sleeping issue in mqueue_flush_file 2024-01-31 16:21:07 -08:00
netrom net: implement lockless SO_PRIORITY 2023-10-01 19:09:54 +01:00
nfc nfc: Do not send datagram if socket state isn't LLCP_BOUND 2023-12-25 07:29:04 +00:00
nsh net: move gso declarations and functions to their own files 2023-06-10 00:11:41 -07:00
openvswitch net/sched: act_ct: Always fill offloading tuple iifidx 2023-11-08 17:47:08 -08:00
packet packet: Move reference count in packet_sock to atomic_long_t 2023-12-04 14:45:04 -08:00
phonet sock: Remove ->sendpage*() in favour of sendmsg(MSG_SPLICE_PAGES) 2023-06-24 15:50:13 -07:00
psample psample: Require 'CAP_NET_ADMIN' when joining "packets" group 2023-12-07 09:54:02 -08:00
qrtr net: qrtr: ns: Return 0 if server port is not present 2024-01-01 18:41:29 +00:00
rds net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv 2024-01-31 16:21:06 -08:00
rfkill net: rfkill: gpio: set GPIO direction 2023-12-12 10:14:57 +01:00
rose net/rose: fix races in rose_kill_by_device() 2023-12-15 11:59:53 +00:00
rxrpc rxrpc: Fix counting of new acks and nacks 2024-02-16 19:14:23 +01:00
sched net/sched: flower: Fix chain template offload 2024-01-31 16:21:07 -08:00
sctp sctp: fix busy polling 2024-01-25 15:44:56 -08:00
smc net/smc: disable SEID on non-s390 archs where virtual ISM may be used 2024-02-05 20:16:56 +00:00
strparser strparser: pad sk_skb_cb to avoid straddling cachelines 2022-07-08 18:38:44 -07:00
sunrpc SUNRPC: Fix a suspicious RCU usage warning 2024-02-05 20:16:48 +00:00
switchdev net: switchdev: Add a helper to replay objects on a bridge port 2023-07-21 08:54:03 +01:00
tipc tipc: Check the bearer type before calling tipc_udp_nl_bearer_add() 2024-02-16 19:14:23 +01:00
tls net: tls, fix WARNIING in __sk_msg_free 2024-01-25 15:45:28 -08:00
unix af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC. 2024-02-16 19:14:23 +01:00
vmw_vsock virtio/vsock: send credit update during setting SO_RCVLOWAT 2024-01-25 15:44:52 -08:00
wireless wifi: cfg80211: detect stuck ECSA element in probe resp 2024-02-16 19:14:19 +01:00
x25 net: implement lockless SO_PRIORITY 2023-10-01 19:09:54 +01:00
xdp xsk: make xsk_buff_pool responsible for clearing xdp_buff::flags 2024-01-31 16:21:09 -08:00
xfrm Including fixes from netfilter and bpf. 2023-11-09 17:09:35 -08:00
compat.c net/compat: Update msg_control_is_user when setting a kernel pointer 2023-04-14 11:09:27 +01:00
devres.c net: devres: Correct a grammatical error 2021-06-11 12:55:28 -07:00
Kconfig net: add skb_segment kunit test 2023-10-11 10:39:01 +01:00
Kconfig.debug net: make NET_(DEV|NS)_REFCNT_TRACKER depend on NET 2022-09-20 14:23:56 -07:00
Makefile net/handshake: Create a NETLINK service for handling handshake requests 2023-04-19 18:48:48 -07:00
socket.c net: Save and restore msg_namelen in sock_sendmsg 2024-01-03 11:37:57 +00:00
sysctl_net.c sysctl: Add size to register_net_sysctl function 2023-08-15 15:26:17 -07:00