Skip to content

Commit 4842a08

Browse files
lxindavem330
authored andcommitted
sctp: init active key for the new asoc in dupcook_a and dupcook_b
When processing a duplicate cookie-echo chunk, for case 'A' and 'B', after sctp_process_init for the new asoc, if auth is enabled for the cookie-ack chunk, the active key should also be initialized. Otherwise, the cookie-ack chunk made later can not be set with auth shkey properly, and a crash can even be caused by this, as after Commit 1b1e0bc ("sctp: add refcnt support for sh_key"), sctp needs to hold the shkey when making control chunks. Fixes: 1b1e0bc ("sctp: add refcnt support for sh_key") Reported-by: Jianwen Ji <jiji@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e6e6a27 commit 4842a08

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎net/sctp/sm_statefuns.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
17941794
GFP_ATOMIC))
17951795
goto nomem;
17961796

1797+
if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1798+
goto nomem;
1799+
17971800
/* Make sure no new addresses are being added during the
17981801
* restart. Though this is a pretty complicated attack
17991802
* since you'd have to get inside the cookie.
@@ -1906,6 +1909,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
19061909
GFP_ATOMIC))
19071910
goto nomem;
19081911

1912+
if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1913+
goto nomem;
1914+
19091915
/* Update the content of current association. */
19101916
sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
19111917
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,

0 commit comments

Comments
 (0)