kernel_optimize_test/net/sctp
Xin Long 44f2e360e7 sctp: move the active_key update after sh_keys is added
[ Upstream commit ae954bbc451d267f7d60d7b49db811d5a68ebd7b ]

In commit 58acd1009226 ("sctp: update active_key for asoc when old key is
being replaced"), sctp_auth_asoc_init_active_key() is called to update
the active_key right after the old key is deleted and before the new key
is added, and it caused that the active_key could be found with the key_id.

In Ying Xu's testing, the BUG_ON in sctp_auth_asoc_init_active_key() was
triggered:

  [ ] kernel BUG at net/sctp/auth.c:416!
  [ ] RIP: 0010:sctp_auth_asoc_init_active_key.part.8+0xe7/0xf0 [sctp]
  [ ] Call Trace:
  [ ]  sctp_auth_set_key+0x16d/0x1b0 [sctp]
  [ ]  sctp_setsockopt.part.33+0x1ba9/0x2bd0 [sctp]
  [ ]  __sys_setsockopt+0xd6/0x1d0
  [ ]  __x64_sys_setsockopt+0x20/0x30
  [ ]  do_syscall_64+0x5b/0x1a0

So fix it by moving the active_key update after sh_keys is added.

Fixes: 58acd1009226 ("sctp: update active_key for asoc when old key is being replaced")
Reported-by: Ying Xu <yinxu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-12 13:22:06 +02:00
..
associola.c net: sctp: associola.c: delete duplicated words 2020-08-24 16:21:43 -07:00
auth.c sctp: move the active_key update after sh_keys is added 2021-08-12 13:22:06 +02:00
bind_addr.c sctp: validate from_addr_param return 2021-07-19 09:44:55 +02:00
chunk.c net: sctp: chunk.c: delete duplicated word 2020-08-24 16:21:43 -07:00
debug.c
diag.c
endpointola.c
input.c sctp: fix return value check in __sctp_rcv_asconf_lookup 2021-08-04 12:46:44 +02:00
inqueue.c
ipv6.c sctp: validate from_addr_param return 2021-07-19 09:44:55 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
objcnt.c
offload.c
output.c
outqueue.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
primitive.c
proc.c net: fix iteration for sctp transport seq_files 2021-02-17 11:02:29 +01:00
protocol.c sctp: move 198 addresses from unusable to private scope 2021-07-31 08:16:11 +02:00
sm_make_chunk.c sctp: validate from_addr_param return 2021-07-19 09:44:55 +02:00
sm_sideeffect.c sctp: change to hold/put transport for proto_unreach_timer 2020-11-14 11:57:12 -08:00
sm_statefuns.c sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b 2021-05-19 10:13:06 +02:00
sm_statetable.c
socket.c sctp: trim optlen when it's a huge value in sctp_setsockopt 2021-07-28 14:35:38 +02:00
stream_interleave.c
stream_sched_prio.c
stream_sched_rr.c
stream_sched.c
stream.c net: sctp: Fix negotiation of the number of data streams. 2020-08-20 16:37:37 -07:00
sysctl.c
transport.c sctp: change to hold/put transport for proto_unreach_timer 2020-11-14 11:57:12 -08:00
tsnmap.c
ulpevent.c
ulpqueue.c net: sctp: ulpqueue.c: delete duplicated word 2020-08-24 16:21:43 -07:00