]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: move the format error check out of __sctp_sf_do_9_1_abort
authorXin Long <lucien.xin@gmail.com>
Tue, 18 Feb 2020 04:07:53 +0000 (12:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:34 +0000 (16:43 +0100)
commitf71b902689df090423e5254bc96bad9f64a995e3
tree27dc3fa3e4c73f980f053038af089c5638d3926b
parent65328ee5bdfbeea5738fefad806bf35d3a46c523
sctp: move the format error check out of __sctp_sf_do_9_1_abort

[ Upstream commit c3853e948180cdf91a731721bfea51bfe7f34058 ]

When T2 timer is to be stopped, the asoc should also be deleted,
otherwise, there will be no chance to call sctp_association_free
and the asoc could last in memory forever.

However, in sctp_sf_shutdown_sent_abort(), after adding the cmd
SCTP_CMD_TIMER_STOP for T2 timer, it may return error due to the
format error from __sctp_sf_do_9_1_abort() and miss adding
SCTP_CMD_ASSOC_FAILED where the asoc will be deleted.

This patch is to fix it by moving the format error check out of
__sctp_sf_do_9_1_abort(), and do it before adding the cmd
SCTP_CMD_TIMER_STOP for T2 timer.

Thanks Hangbin for reporting this issue by the fuzz testing.

v1->v2:
  - improve the comment in the code as Marcelo's suggestion.

Fixes: 67fde9e5f215 ("sctp: check invalid value of length parameter in error cause")
Reported-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sctp/sm_statefuns.c