linux-stable/net/tipc
Xin Long b57a4a2dc8 tipc: force a dst refcount before doing decryption
[ Upstream commit 2ebe8f840c ]

As it says in commit 3bc07321cc ("xfrm: Force a dst refcount before
entering the xfrm type handlers"):

"Crypto requests might return asynchronous. In this case we leave the
 rcu protected region, so force a refcount on the skb's destination
 entry before we enter the xfrm type input/output handlers."

On TIPC decryption path it has the same problem, and skb_dst_force()
should be called before doing decryption to avoid a possible crash.

Shuang reported this issue when this warning is triggered:

  [] WARNING: include/net/dst.h:337 tipc_sk_rcv+0x1055/0x1ea0 [tipc]
  [] Kdump: loaded Tainted: G W --------- - - 4.18.0-496.el8.x86_64+debug
  [] Workqueue: crypto cryptd_queue_worker
  [] RIP: 0010:tipc_sk_rcv+0x1055/0x1ea0 [tipc]
  [] Call Trace:
  [] tipc_sk_mcast_rcv+0x548/0xea0 [tipc]
  [] tipc_rcv+0xcf5/0x1060 [tipc]
  [] tipc_aead_decrypt_done+0x215/0x2e0 [tipc]
  [] cryptd_aead_crypt+0xdb/0x190
  [] cryptd_queue_worker+0xed/0x190
  [] process_one_work+0x93d/0x17e0

Fixes: fc1b6d6de2 ("tipc: introduce TIPC encryption & authentication")
Reported-by: Shuang Li <shuali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/fbe3195fad6997a4eec62d9bf076b2ad03ac336b.1718476040.git.lucien.xin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:07 +02:00
..
addr.c
addr.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
bcast.c net: tipc: fix FB_MTU eat two pages 2021-06-28 13:31:57 -07:00
bcast.h
bearer.c tipc: Check the bearer type before calling tipc_udp_nl_bearer_add() 2024-02-16 19:10:50 +01:00
bearer.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
core.c tipc: fix use-after-free Read in tipc_named_reinit 2022-06-17 11:39:10 +01:00
core.h minmax: add in_range() macro 2023-08-24 16:20:18 -07:00
crypto.c tipc: fix a potential deadlock on &tx->lock 2023-10-04 13:24:12 -07:00
crypto.h
diag.c
discover.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
discover.h
eth_media.c tipc: constify dev_addr passing 2021-10-13 09:40:46 -07:00
group.c
group.h
ib_media.c tipc: constify dev_addr passing 2021-10-13 09:40:46 -07:00
Kconfig
link.c tipc: Use size_add() in calls to struct_size() 2023-11-20 11:58:57 +01:00
link.h tipc: Remove unused declaration tipc_link_build_bc_sync_msg() 2023-08-09 13:03:14 -07:00
Makefile
monitor.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
monitor.h
msg.c tipc: fix UAF in error path 2024-05-17 12:02:32 +02:00
msg.h net: tipc: remove unused static inlines 2022-01-27 13:53:27 +00:00
name_distr.c net/tipc: Remove unused struct distr_queue_item 2022-09-29 18:48:32 -07:00
name_distr.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
name_table.c tipc: cleanup unused function 2022-06-17 11:43:57 +01:00
name_table.h tipc: cleanup unused function 2022-06-17 11:43:57 +01:00
net.c
net.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
netlink.c tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING 2023-11-20 11:59:34 +01:00
netlink.h
netlink_compat.c tipc: Fix kernel-infoleak due to uninitialized TLV value 2023-11-28 17:19:51 +00:00
node.c tipc: force a dst refcount before doing decryption 2024-06-27 13:49:07 +02:00
node.h
socket.c genetlink: use attrs from struct genl_info 2023-08-15 15:00:45 -07:00
socket.h
subscr.c tipc:subscr.c: fix a spelling mistake 2021-06-10 13:48:43 -07:00
subscr.h
sysctl.c
topsrv.c net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
topsrv.h
trace.c
trace.h
udp_media.c genetlink: use attrs from struct genl_info 2023-08-15 15:00:45 -07:00
udp_media.h