]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: fix missing wake ups in some situations
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Fri, 8 Sep 2017 14:35:21 +0000 (11:35 -0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Sep 2017 17:02:47 +0000 (10:02 -0700)
commitd1e8649e2e5b88a37f82baa762f4217bfd78c6eb
tree77f839bbab22d04cd92ed2aa961c65fd3749be9c
parentf764f7f3b066ff7f6900098020eac4bf033e8487
sctp: fix missing wake ups in some situations

Commit 49dde45d774a ("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 a9c64aed950f ("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: 49dde45d774a ("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>
net/sctp/ulpqueue.c