On Mon, Nov 30, 2026 at 2:45 PM Kyuwon Cho <kyuw…@gmail.com> wrote:
>
> sctp_sf_do_5_1C_ack() queues SCTP_CMD_PEER_INIT and SCTP_CMD_ASSOC_SHKEY.
> If either fails, sctp_cmd_interpreter() stops there, but the association
> stays: with the peer marked AUTH capable and asoc->shkey still NULL, a
> chunk that the peer wants authenticated, such as the ABORT built by
> close() with SO_LINGER {1, 0}, takes a reference on the NULL key:
>
> BUG: KASAN: null-ptr-deref in sctp_auth_shkey_hold (net/sctp/auth.c:113)
> Write of size 4 at addr 0000000000000018
> Call Trace:
> sctp_auth_shkey_hold (net/sctp/auth.c:113)
> sctp_control_set_owner_w (net/sctp/sm_make_chunk.c:112)
> sctp_make_abort_user (net/sctp/sm_make_chunk.c:1016)
> sctp_close (net/sctp/socket.c:1564)
>
> Process the INIT-ACK and set up the association key directly in
> sctp_sf_do_5_1C_ack(), and abort the association with
> sctp_stop_t1_and_abort() if either step fails, as is done when the
> INIT-ACK fails verification. This also aborts when sctp_process_init()
> rejects a peer that is ASCONF capable but not AUTH capable, which used
> to drop the INIT-ACK and leave T1-init to expire. SCTP_CMD_PEER_INIT
> and SCTP_CMD_ASSOC_SHKEY have no other users, so remove them.
>
> Fixes: 1b1e0bc99474 ("sctp: add refcnt support for sh_key")
> Suggested-by: Xin Long <luci…@gmail.com>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Kyuwon Cho <kyuw…@gmail.com>
Acked-by: Xin Long <luci…@gmail.com>