This is a note to let you know that I've just added the patch titled sctp: support MSG_ERRQUEUE flag in recvmsg() to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sctp-support-msg_errqueue-flag-in-recvmsg.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 40e5baf01a104efbf56e51e070ef67681aad548b Author: Eric Dumazet <edumazet@xxxxxxxxxx> Date: Tue Dec 12 14:55:50 2023 +0000 sctp: support MSG_ERRQUEUE flag in recvmsg() [ Upstream commit 4746b36b1abe11ca32987b2d21e1e770deab17cc ] For some reason sctp_poll() generates EPOLLERR if sk->sk_error_queue is not empty but recvmsg() can not drain the error queue yet. This is needed to better support timestamping. I had to export inet_recv_error(), since sctp can be compiled as a module. Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Cc: Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx> Cc: Willem de Bruijn <willemb@xxxxxxxxxx> Acked-by: Xin Long <lucien.xin@xxxxxxxxx> Link: https://lore.kernel.org/r/20231212145550.3872051-1-edumazet@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Stable-dep-of: a562c0a2d651 ("sctp: fix busy polling") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 347c3768df6e..c13b8ed63f87 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1642,6 +1642,7 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) #endif return -EINVAL; } +EXPORT_SYMBOL(inet_recv_error); int inet_gro_complete(struct sk_buff *skb, int nhoff) { diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e25dc1709131..da56832179f0 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2098,6 +2098,9 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, pr_debug("%s: sk:%p, msghdr:%p, len:%zd, flags:0x%x, addr_len:%p)\n", __func__, sk, msg, len, flags, addr_len); + if (unlikely(flags & MSG_ERRQUEUE)) + return inet_recv_error(sk, msg, len, addr_len); + lock_sock(sk); if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED) &&