• Xin Long's avatar
    sctp: update frag_point when stream_interleave is set · 4135cce7
    Xin Long authored
    sctp_assoc_update_frag_point() should be called whenever asoc->pathmtu
    changes, but we missed one place in sctp_association_init(). It would
    cause frag_point is zero when sending data.
    
    As says in Jakub's reproducer, if sp->pathmtu is set by socketopt, the
    new asoc->pathmtu inherits it in sctp_association_init(). Later when
    transports are added and their pmtu >= asoc->pathmtu, it will never
    call sctp_assoc_update_frag_point() to set frag_point.
    
    This patch is to fix it by updating frag_point after asoc->pathmtu is
    set as sp->pathmtu in sctp_association_init(). Note that it moved them
    after sctp_stream_init(), as stream->si needs to be set first.
    
    Frag_point's calculation is also related with datachunk's type, so it
    needs to update frag_point when stream->si may be changed in
    sctp_process_init().
    
    v1->v2:
      - call sctp_assoc_update_frag_point() separately in sctp_process_init
        and sctp_association_init, per Marcelo's suggestion.
    
    Fixes: 2f5e3c9d ("sctp: introduce sctp_assoc_update_frag_point")
    Reported-by: default avatarJakub Audykowicz <jakub.audykowicz@gmail.com>
    Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
    Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4135cce7
sm_make_chunk.c 116 KB