]> git.baikalelectronics.ru Git - kernel.git/commit
Fix memory leak in discard case of sctp_sf_abort_violation()
authorJesper Juhl <jesper.juhl@gmail.com>
Sun, 11 Nov 2007 22:57:49 +0000 (23:57 +0100)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Mon, 12 Nov 2007 15:13:24 +0000 (10:13 -0500)
commit0ef76017666c7e2c2c5724fbeefd90b5bfdd02ae
tree2eeb675c127afb5b92646f7a27ad434438018994
parentd51baa88d293263988142d15cd3aa6eb8a088e69
Fix memory leak in discard case of sctp_sf_abort_violation()

In net/sctp/sm_statefuns.c::sctp_sf_abort_violation() we may leak
the storage allocated for 'abort' by returning from the function
without using or freeing it. This happens in case
"sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)" is true and we jump to
the 'discard' label.
Spotted by the Coverity checker.

The simple fix is to simply move the creation of the "abort chunk"
to after the possible jump to the 'discard' label. This way we don't
even have to allocate the memory at all in the problem case.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
net/sctp/sm_statefuns.c