]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sctp: Do not wake readers in __sctp_write_space()
authorPetr Malat <oss@malat.biz>
Fri, 16 May 2025 08:17:28 +0000 (10:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:04:18 +0000 (11:04 +0100)
[ Upstream commit af295892a7abbf05a3c2ba7abc4d81bb448623d6 ]

Function __sctp_write_space() doesn't set poll key, which leads to
ep_poll_callback() waking up all waiters, not only these waiting
for the socket being writable. Set the key properly using
wake_up_interruptible_poll(), which is preferred over the sync
variant, as writers are not woken up before at least half of the
queue is available. Also, TCP does the same.

Signed-off-by: Petr Malat <oss@malat.biz>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20250516081727.1361451-1-oss@malat.biz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sctp/socket.c

index 3d6c9e35781e9d87833e452a480f808f884c9c75..196196ebe81a9cb0ba2cd9047afb16512e91eb0d 100644 (file)
@@ -8849,7 +8849,8 @@ static void __sctp_write_space(struct sctp_association *asoc)
                wq = rcu_dereference(sk->sk_wq);
                if (wq) {
                        if (waitqueue_active(&wq->wait))
-                               wake_up_interruptible(&wq->wait);
+                               wake_up_interruptible_poll(&wq->wait, EPOLLOUT |
+                                               EPOLLWRNORM | EPOLLWRBAND);
 
                        /* Note that we try to include the Async I/O support
                         * here by modeling from the current TCP/UDP code.