linux-stable/include/net
David Howells 92128a7170 rxrpc: Fix timeout of a call that hasn't yet been granted a channel
[ Upstream commit db099c625b ]

afs_make_call() calls rxrpc_kernel_begin_call() to begin a call (which may
get stalled in the background waiting for a connection to become
available); it then calls rxrpc_kernel_set_max_life() to set the timeouts -
but that starts the call timer so the call timer might then expire before
we get a connection assigned - leading to the following oops if the call
stalled:

	BUG: kernel NULL pointer dereference, address: 0000000000000000
	...
	CPU: 1 PID: 5111 Comm: krxrpcio/0 Not tainted 6.3.0-rc7-build3+ #701
	RIP: 0010:rxrpc_alloc_txbuf+0xc0/0x157
	...
	Call Trace:
	 <TASK>
	 rxrpc_send_ACK+0x50/0x13b
	 rxrpc_input_call_event+0x16a/0x67d
	 rxrpc_io_thread+0x1b6/0x45f
	 ? _raw_spin_unlock_irqrestore+0x1f/0x35
	 ? rxrpc_input_packet+0x519/0x519
	 kthread+0xe7/0xef
	 ? kthread_complete_and_exit+0x1b/0x1b
	 ret_from_fork+0x22/0x30

Fix this by noting the timeouts in struct rxrpc_call when the call is
created.  The timer will be started when the first packet is transmitted.

It shouldn't be possible to trigger this directly from userspace through
AF_RXRPC as sendmsg() will return EBUSY if the call is in the
waiting-for-conn state if it dropped out of the wait due to a signal.

Fixes: 9d35d880e0 ("rxrpc: Move client call connection to the I/O thread")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-17 13:58:47 +02:00
..
9p
bluetooth Bluetooth: Fix printing errors if LE Connection times out 2023-04-20 12:36:54 +02:00
caif
iucv
mana net: mana: Fix IRQ name - add PCI and queue number 2023-01-20 18:17:17 -08:00
netfilter netfilter: nf_tables: deactivate anonymous set from preparation phase 2023-05-11 23:11:36 +09:00
netns netfilter: ctnetlink: make event listener tracking global 2023-03-11 13:50:30 +01:00
nfc
phonet
sctp sctp: add a refcnt in sctp_stream_priorities to avoid a nested loop 2023-03-11 13:50:31 +01:00
tc_act net/sched: transition act_pedit to rcu and percpu stats 2023-03-11 13:50:33 +01:00
6lowpan.h
Space.h
act_api.h
addrconf.h
af_ieee802154.h
af_rxrpc.h rxrpc: Fix timeout of a call that hasn't yet been granted a channel 2023-05-17 13:58:47 +02:00
af_unix.h
af_vsock.h
ah.h
amt.h
arp.h
atmclip.h
ax25.h
ax88796.h
bareudp.h
bond_3ad.h
bond_alb.h
bond_options.h
bonding.h bonding: fix ns validation on backup slaves 2023-04-20 12:36:54 +02:00
bpf_sk_storage.h
busy_poll.h
calipso.h
cfg80211-wext.h
cfg80211.h
cfg802154.h
checksum.h
cipso_ipv4.h
cls_cgroup.h
codel.h
codel_impl.h
codel_qdisc.h
compat.h
datalink.h
dcbevent.h
dcbnl.h
devlink.h net: devlink: add DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER 2022-12-12 11:39:13 +01:00
dropreason.h
dsa.h
dsfield.h
dst.h
dst_cache.h
dst_metadata.h
dst_ops.h
erspan.h
esp.h
espintcp.h
ethoc.h
failover.h
fib_notifier.h
fib_rules.h
firewire.h
flow.h
flow_dissector.h
flow_offload.h
fou.h
fq.h
fq_impl.h
garp.h
gen_stats.h
genetlink.h
geneve.h
gre.h
gro.h
gro_cells.h
gtp.h
gue.h
hwbm.h
icmp.h
ieee80211_radiotap.h
ieee802154_netdev.h
if_inet6.h
ife.h
ila.h
inet6_connection_sock.h
inet6_hashtables.h
inet_common.h
inet_connection_sock.h
inet_dscp.h
inet_ecn.h
inet_frag.h
inet_hashtables.h tcp: Add TIME_WAIT sockets in bhash2. 2022-12-30 07:25:52 +00:00
inet_sock.h
inet_timewait_sock.h tcp: Add TIME_WAIT sockets in bhash2. 2022-12-30 07:25:52 +00:00
inetpeer.h
ioam6.h
ip.h
ip6_checksum.h
ip6_fib.h
ip6_route.h
ip6_tunnel.h
ip_fib.h
ip_tunnels.h
ip_vs.h ipvs: run_estimation should control the kthread tasks 2022-12-10 22:44:43 +01:00
ipcomp.h
ipconfig.h
ipv6.h IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver 2022-12-12 15:41:44 -08:00
ipv6_frag.h
ipv6_stubs.h
iw_handler.h
kcm.h
l3mdev.h
lag.h
lapb.h
lib80211.h
llc.h
llc_c_ac.h
llc_c_ev.h
llc_c_st.h
llc_conn.h
llc_if.h
llc_pdu.h
llc_s_ac.h
llc_s_ev.h
llc_s_st.h
llc_sap.h
lwtunnel.h
mac80211.h wifi: mac80211: Proper mark iTXQs for resumption 2023-01-10 13:24:12 +01:00
mac802154.h
macsec.h
mctp.h
mctpdevice.h
mip6.h
mld.h
mpls.h
mpls_iptunnel.h
mptcp.h mptcp: remove MPTCP 'ifdef' in TCP SYN cookies 2022-12-12 13:11:24 -08:00
mrp.h
ncsi.h
ndisc.h
neighbour.h
net_debug.h
net_failover.h
net_namespace.h
net_ratelimit.h
net_trackers.h
netevent.h
netlabel.h
netlink.h
netprio_cgroup.h
netrom.h
nexthop.h
nl802154.h
nsh.h
p8022.h
page_pool.h
pie.h
ping.h
pkt_cls.h
pkt_sched.h
pptp.h
protocol.h
psample.h
psnap.h
raw.h raw: Fix NULL deref in raw_get_next(). 2023-04-13 17:02:41 +02:00
rawv6.h
red.h
regulatory.h
request_sock.h
rose.h
route.h
rpl.h
rsi_91x.h
rtnetlink.h
rtnh.h
sch_generic.h net/sched: sch_taprio: fix possible use-after-free 2023-01-16 13:25:34 +00:00
scm.h scm: fix MSG_CTRUNC setting condition for SO_PASSSEC 2023-05-11 23:11:08 +09:00
secure_seq.h
seg6.h
seg6_hmac.h
seg6_local.h
selftests.h
slhc_vj.h
smc.h
snmp.h
sock.h net: add sock_init_data_uid() 2023-03-10 09:28:16 +01:00
sock_reuseport.h
stp.h
strparser.h
switchdev.h
tc_wrapper.h net/sched: Retire tcindex classifier 2023-03-11 13:50:20 +01:00
tcp.h bpf-next-for-netdev 2022-12-12 11:27:42 -08:00
tcp_states.h
timewait_sock.h
tipc.h
tls.h
tls_toe.h
transp_v6.h
tso.h net: tso: inline tso_count_descs() 2022-12-12 15:04:39 -08:00
tun_proto.h
udp.h
udp_tunnel.h
udplite.h
vsock_addr.h
vxlan.h
wext.h
x25.h
x25device.h
xdp.h
xdp_priv.h
xdp_sock.h
xdp_sock_drv.h
xfrm.h bpf-next-for-netdev 2022-12-12 11:27:42 -08:00
xsk_buff_pool.h xsk: Fix unaligned descriptor validation 2023-05-11 23:11:12 +09:00