Skip to content

Commit 7906b00

Browse files
marceloleitnerdavem330
authored andcommitted
sctp: fix missing wake ups in some situations
Commit fb586f2 ("sctp: delay calls to sk_data_ready() as much as possible") minimized the number of wake ups that are triggered in case the association receives a packet with multiple data chunks on it and/or when io_events are enabled and then commit 0970f5b ("sctp: signal sk_data_ready earlier on data chunks reception") moved the wake up to as soon as possible. It thus relies on the state machine running later to clean the flag that the event was already generated. The issue is that there are 2 call paths that calls sctp_ulpq_tail_event() outside of the state machine, causing the flag to linger and possibly omitting a needed wake up in the sequence. One of the call paths is when enabling SCTP_SENDER_DRY_EVENTS via setsockopt(SCTP_EVENTS), as noticed by Harald Welte. The other is when partial reliability triggers removal of chunks from the send queue when the application calls sendmsg(). This commit fixes it by not setting the flag in case the socket is not owned by the user, as it won't be cleaned later. This works for user-initiated calls and also for rx path processing. Fixes: fb586f2 ("sctp: delay calls to sk_data_ready() as much as possible") Reported-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ba1cc08 commit 7906b00

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/sctp/ulpqueue.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
265265
sctp_ulpq_clear_pd(ulpq);
266266

267267
if (queue == &sk->sk_receive_queue && !sp->data_ready_signalled) {
268-
sp->data_ready_signalled = 1;
268+
if (!sock_owned_by_user(sk))
269+
sp->data_ready_signalled = 1;
269270
sk->sk_data_ready(sk);
270271
}
271272
return 1;

0 commit comments

Comments
 (0)