summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2010-06-05 21:20:28 +0000
committerrrs <rrs@FreeBSD.org>2010-06-05 21:20:28 +0000
commit24eae4311a1ead2984d05424fe13d91fb649e9aa (patch)
tree6a529f62c7c935e3efe6f43533776636d55a80ce
parent7d3c46ab4c339f80c43882895ddd4543a6aec864 (diff)
downloadFreeBSD-src-24eae4311a1ead2984d05424fe13d91fb649e9aa.zip
FreeBSD-src-24eae4311a1ead2984d05424fe13d91fb649e9aa.tar.gz
This does two changes:
1) Makes it so that the INVARIANT function validate nolocks is available anywhere. 2) Fixes a BUG where a close has been done on a collision socket and the cookie processing would return leaving a lock held. MFC after: 1 week
-rw-r--r--sys/netinet/sctp_input.c18
-rw-r--r--sys/netinet/sctp_pcb.h6
2 files changed, 18 insertions, 6 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 8b5df02..b110adc 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -3067,7 +3067,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
struct sctp_nets *net, uint8_t flg)
{
switch (desc->chunk_type) {
- case SCTP_DATA:
+ case SCTP_DATA:
/* find the tsn to resend (possibly */
{
uint32_t tsn;
@@ -4861,6 +4861,9 @@ process_control_chunks:
} else {
if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
/* We are not interested anymore */
+ if (stcb) {
+ SCTP_TCB_UNLOCK(stcb);
+ }
*offset = length;
return (NULL);
}
@@ -5408,13 +5411,16 @@ sctp_process_ecn_marked_b(struct sctp_tcb *stcb, struct sctp_nets *net,
}
#ifdef INVARIANTS
-static void
-sctp_validate_no_locks(struct sctp_inpcb *inp)
+#ifdef __GNUC__
+__attribute__((noinline))
+#endif
+ void
+ sctp_validate_no_locks(struct sctp_inpcb *inp)
{
- struct sctp_tcb *stcb;
+ struct sctp_tcb *lstcb;
- LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
- if (mtx_owned(&stcb->tcb_mtx)) {
+ LIST_FOREACH(lstcb, &inp->sctp_asoc_list, sctp_tcblist) {
+ if (mtx_owned(&lstcb->tcb_mtx)) {
panic("Own lock on stcb at return from input");
}
}
diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h
index 6f657e8..318b012 100644
--- a/sys/netinet/sctp_pcb.h
+++ b/sys/netinet/sctp_pcb.h
@@ -621,5 +621,11 @@ sctp_initiate_iterator(inp_func inpf,
struct sctp_inpcb *,
uint8_t co_off);
+#ifdef INVARIANTS
+void
+ sctp_validate_no_locks(struct sctp_inpcb *inp);
+
+#endif
+
#endif /* _KERNEL */
#endif /* !__sctp_pcb_h__ */
OpenPOWER on IntegriCloud