• X
    sctp: fix the check for _sctp_walk_params and _sctp_walk_errors · 6b84202c
    Xin Long 提交于
    Commit b1f5bfc2 ("sctp: don't dereference ptr before leaving
    _sctp_walk_{params, errors}()") tried to fix the issue that it
    may overstep the chunk end for _sctp_walk_{params, errors} with
    'chunk_end > offset(length) + sizeof(length)'.
    
    But it introduced a side effect: When processing INIT, it verifies
    the chunks with 'param.v == chunk_end' after iterating all params
    by sctp_walk_params(). With the check 'chunk_end > offset(length)
    + sizeof(length)', it would return when the last param is not yet
    accessed. Because the last param usually is fwdtsn supported param
    whose size is 4 and 'chunk_end == offset(length) + sizeof(length)'
    
    This is a badly issue even causing sctp couldn't process 4-shakes.
    Client would always get abort when connecting to server, due to
    the failure of INIT chunk verification on server.
    
    The patch is to use 'chunk_end <= offset(length) + sizeof(length)'
    instead of 'chunk_end < offset(length) + sizeof(length)' for both
    _sctp_walk_params and _sctp_walk_errors.
    
    Fixes: b1f5bfc2 ("sctp: don't dereference ptr before leaving _sctp_walk_{params, errors}()")
    Signed-off-by: NXin Long <lucien.xin@gmail.com>
    Acked-by: NNeil Horman <nhorman@tuxdriver.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    6b84202c
sctp.h 19.2 KB