@@ -1773,6 +1773,30 @@ enum sctp_disposition sctp_sf_do_5_2_3_initack(
1773
1773
return sctp_sf_discard_chunk (net , ep , asoc , type , arg , commands );
1774
1774
}
1775
1775
1776
+ static int sctp_sf_do_assoc_update (struct sctp_association * asoc ,
1777
+ struct sctp_association * new ,
1778
+ struct sctp_cmd_seq * cmds )
1779
+ {
1780
+ struct net * net = asoc -> base .net ;
1781
+ struct sctp_chunk * abort ;
1782
+
1783
+ if (!sctp_assoc_update (asoc , new ))
1784
+ return 0 ;
1785
+
1786
+ abort = sctp_make_abort (asoc , NULL , sizeof (struct sctp_errhdr ));
1787
+ if (abort ) {
1788
+ sctp_init_cause (abort , SCTP_ERROR_RSRC_LOW , 0 );
1789
+ sctp_add_cmd_sf (cmds , SCTP_CMD_REPLY , SCTP_CHUNK (abort ));
1790
+ }
1791
+ sctp_add_cmd_sf (cmds , SCTP_CMD_SET_SK_ERR , SCTP_ERROR (ECONNABORTED ));
1792
+ sctp_add_cmd_sf (cmds , SCTP_CMD_ASSOC_FAILED ,
1793
+ SCTP_PERR (SCTP_ERROR_RSRC_LOW ));
1794
+ SCTP_INC_STATS (net , SCTP_MIB_ABORTEDS );
1795
+ SCTP_DEC_STATS (net , SCTP_MIB_CURRESTAB );
1796
+
1797
+ return - ENOMEM ;
1798
+ }
1799
+
1776
1800
/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A')
1777
1801
*
1778
1802
* Section 5.2.4
@@ -1852,20 +1876,22 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
1852
1876
SCTP_TO (SCTP_EVENT_TIMEOUT_T4_RTO ));
1853
1877
sctp_add_cmd_sf (commands , SCTP_CMD_PURGE_ASCONF_QUEUE , SCTP_NULL ());
1854
1878
1855
- repl = sctp_make_cookie_ack (new_asoc , chunk );
1879
+ /* Update the content of current association. */
1880
+ if (sctp_sf_do_assoc_update ((struct sctp_association * )asoc , new_asoc , commands ))
1881
+ goto nomem ;
1882
+
1883
+ repl = sctp_make_cookie_ack (asoc , chunk );
1856
1884
if (!repl )
1857
1885
goto nomem ;
1858
1886
1859
1887
/* Report association restart to upper layer. */
1860
1888
ev = sctp_ulpevent_make_assoc_change (asoc , 0 , SCTP_RESTART , 0 ,
1861
- new_asoc -> c .sinit_num_ostreams ,
1862
- new_asoc -> c .sinit_max_instreams ,
1889
+ asoc -> c .sinit_num_ostreams ,
1890
+ asoc -> c .sinit_max_instreams ,
1863
1891
NULL , GFP_ATOMIC );
1864
1892
if (!ev )
1865
1893
goto nomem_ev ;
1866
1894
1867
- /* Update the content of current association. */
1868
- sctp_add_cmd_sf (commands , SCTP_CMD_UPDATE_ASSOC , SCTP_ASOC (new_asoc ));
1869
1895
sctp_add_cmd_sf (commands , SCTP_CMD_EVENT_ULP , SCTP_ULPEVENT (ev ));
1870
1896
if ((sctp_state (asoc , SHUTDOWN_PENDING ) ||
1871
1897
sctp_state (asoc , SHUTDOWN_SENT )) &&
@@ -1877,7 +1903,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
1877
1903
*/
1878
1904
sctp_add_cmd_sf (commands , SCTP_CMD_REPLY , SCTP_CHUNK (repl ));
1879
1905
return sctp_sf_do_9_2_start_shutdown (net , ep , asoc ,
1880
- SCTP_ST_CHUNK (0 ), repl ,
1906
+ SCTP_ST_CHUNK (0 ), NULL ,
1881
1907
commands );
1882
1908
} else {
1883
1909
sctp_add_cmd_sf (commands , SCTP_CMD_NEW_STATE ,
@@ -1925,14 +1951,16 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
1925
1951
if (!sctp_auth_chunk_verify (net , chunk , new_asoc ))
1926
1952
return SCTP_DISPOSITION_DISCARD ;
1927
1953
1928
- /* Update the content of current association. */
1929
- sctp_add_cmd_sf (commands , SCTP_CMD_UPDATE_ASSOC , SCTP_ASOC (new_asoc ));
1930
1954
sctp_add_cmd_sf (commands , SCTP_CMD_NEW_STATE ,
1931
1955
SCTP_STATE (SCTP_STATE_ESTABLISHED ));
1932
1956
SCTP_INC_STATS (net , SCTP_MIB_CURRESTAB );
1933
1957
sctp_add_cmd_sf (commands , SCTP_CMD_HB_TIMERS_START , SCTP_NULL ());
1934
1958
1935
- repl = sctp_make_cookie_ack (new_asoc , chunk );
1959
+ /* Update the content of current association. */
1960
+ if (sctp_sf_do_assoc_update ((struct sctp_association * )asoc , new_asoc , commands ))
1961
+ goto nomem ;
1962
+
1963
+ repl = sctp_make_cookie_ack (asoc , chunk );
1936
1964
if (!repl )
1937
1965
goto nomem ;
1938
1966
@@ -5521,7 +5549,7 @@ enum sctp_disposition sctp_sf_do_9_2_start_shutdown(
5521
5549
* in the Cumulative TSN Ack field the last sequential TSN it
5522
5550
* has received from the peer.
5523
5551
*/
5524
- reply = sctp_make_shutdown (asoc , arg );
5552
+ reply = sctp_make_shutdown (asoc , NULL );
5525
5553
if (!reply )
5526
5554
goto nomem ;
5527
5555
@@ -6119,7 +6147,7 @@ enum sctp_disposition sctp_sf_autoclose_timer_expire(
6119
6147
disposition = SCTP_DISPOSITION_CONSUME ;
6120
6148
if (sctp_outq_is_empty (& asoc -> outqueue )) {
6121
6149
disposition = sctp_sf_do_9_2_start_shutdown (net , ep , asoc , type ,
6122
- NULL , commands );
6150
+ arg , commands );
6123
6151
}
6124
6152
6125
6153
return disposition ;
0 commit comments