git: 615ff3cb608f - stable/13 - sctp: don't keep being locked on a stream which is removed

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 22:59:25 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=615ff3cb608f6d127a8b87307b7f14d169ad06f6

commit 615ff3cb608f6d127a8b87307b7f14d169ad06f6
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-10-01 22:48:01 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 22:59:05 +0000

    sctp: don't keep being locked on a stream which is removed
    
    Reported by:    syzbot+f5f551e8a3a0302a4914@syzkaller.appspotmail.com
    
    (cherry picked from commit 3ff3733991ba049959c4fd2e7179ea96241a396e)
---
 sys/netinet/sctp_ss_functions.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c
index 5293c0fee742..c08bec07c588 100644
--- a/sys/netinet/sctp_ss_functions.c
+++ b/sys/netinet/sctp_ss_functions.c
@@ -150,6 +150,9 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc,
 				asoc->ss_data.last_out_stream = NULL;
 			}
 		}
+		if (asoc->ss_data.locked_on_sending == strq) {
+			asoc->ss_data.locked_on_sending = NULL;
+		}
 		TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke);
 		strq->ss_params.scheduled = false;
 	}
@@ -466,6 +469,9 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc,
 				asoc->ss_data.last_out_stream = NULL;
 			}
 		}
+		if (asoc->ss_data.locked_on_sending == strq) {
+			asoc->ss_data.locked_on_sending = NULL;
+		}
 		TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke);
 		strq->ss_params.scheduled = false;
 	}
@@ -635,6 +641,9 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc,
 				asoc->ss_data.last_out_stream = NULL;
 			}
 		}
+		if (asoc->ss_data.locked_on_sending == strq) {
+			asoc->ss_data.locked_on_sending = NULL;
+		}
 		TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke);
 		strq->ss_params.scheduled = false;
 	}