]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: refactor sctp_packet_append_chunk and clenup some memory leaks
authorNeil Horman <nhorman@tuxdriver.com>
Mon, 2 Jul 2012 09:59:24 +0000 (09:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jul 2012 06:56:16 +0000 (23:56 -0700)
commite200108c42a221e4ce96a539be566a74ba021d0a
tree2b1854d347f77cfd71a145b3976ebecc1dabf02c
parent247e231eca1eceea76bf3b768f500c89af217116
sctp: refactor sctp_packet_append_chunk and clenup some memory leaks

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: Neil 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: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/output.c