• Neil Horman's avatar
    sctp: refactor sctp_packet_append_chunk and clenup some memory leaks · ed106277
    Neil Horman authored
    While doing some recent work on sctp sack bundling I noted that
    sctp_packet_append_chunk was pretty inefficient.  Specifially, it was called
    recursively while trying to bundle auth and sack chunks.  Because of that we
    call sctp_packet_bundle_sack and sctp_packet_bundle_auth a total of 4 times for
    every call to sctp_packet_append_chunk, knowing that at least 3 of those calls
    will do nothing.
    
    So lets refactor sctp_packet_bundle_auth to have an outer part that does the
    attempted bundling, and an inner part that just does the chunk appends.  This
    saves us several calls per iteration that we just don't need.
    
    Also, noticed that the auth and sack bundling fail to free the chunks they
    allocate if the append fails, so make sure we add that in
    Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
    CC: Vlad Yasevich <vyasevich@gmail.com>
    CC: "David S. Miller" <davem@davemloft.net>
    CC: linux-sctp@vger.kernel.org
    Acked-by: default avatarVlad Yasevich <vyasevich@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ed106277
output.c 22.4 KB