Date: Wed, 1 Feb 2023 22:27:19 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 842ec9984a98 - stable/13 - sctp: don't lock an already locked stcb. Message-ID: <202302012227.311MRJLW071814@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=842ec9984a98c8dddbdd49d8f5586f3b63f05872 commit 842ec9984a98c8dddbdd49d8f5586f3b63f05872 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2022-03-29 14:33:53 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2023-02-01 22:26:44 +0000 sctp: don't lock an already locked stcb. Reported by: syzbot+e8dca84da3b4b82f4400@syzkaller.appspotmail.com (cherry picked from commit 5d0c76c7302bad0cd0a9f83a30e11d70141adf37) --- sys/netinet/sctp_output.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index c8e1cc4e3bb2..0bdf4c86d64d 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -13374,22 +13374,25 @@ skip_preblock: } SOCKBUF_UNLOCK(&so->so_snd); - SCTP_TCB_LOCK(stcb); - hold_tcblock = true; - stcb->block_entry = NULL; - if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || - (asoc->state & SCTP_STATE_WAS_ABORTED)) { - if (asoc->state & SCTP_STATE_WAS_ABORTED) { - /* - * XXX: Could also be ECONNABORTED, - * not enough info. - */ - error = ECONNRESET; - } else { - error = ENOTCONN; + if (!hold_tcblock) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = true; + if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || + (asoc->state & SCTP_STATE_WAS_ABORTED)) { + if (asoc->state & SCTP_STATE_WAS_ABORTED) { + /* + * XXX: Could also be + * ECONNABORTED, not enough + * info. + */ + error = ECONNRESET; + } else { + error = ENOTCONN; + } + goto out; } - goto out; } + stcb->block_entry = NULL; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK, asoc, asoc->total_output_queue_size);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302012227.311MRJLW071814>