git: 6ac71c4a5234 - main - unix/stream: fix poll on a peer shutdown(2)ed socket

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 30 May 2025 18:52:27 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=6ac71c4a52348fc2e47d7d4a5c06c5ffc45660f3

commit 6ac71c4a52348fc2e47d7d4a5c06c5ffc45660f3
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-05-30 18:51:04 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-05-30 18:51:04 +0000

    unix/stream: fix poll on a peer shutdown(2)ed socket
    
    Add missing poll events mask that was lost while refactoring
    sopoll_generic().
    
    Reported by:    kevans
    Fixes:          d15792780760ef94647af9b377b5f0a80e1826bc
---
 sys/kern/uipc_usrreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index c411f22970e7..95d857b2625d 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1685,7 +1685,8 @@ uipc_sopoll_stream_or_seqpacket(struct socket *so, int events,
 			    so->so_error || so->so_rerror)
 				revents |= events & (POLLIN | POLLRDNORM);
 			if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
-				revents |= events & POLLRDHUP;
+				revents |= events &
+				    (POLLIN | POLLRDNORM | POLLRDHUP);
 			if (!(revents & (POLLIN | POLLRDNORM | POLLRDHUP))) {
 				selrecord(td, &so->so_rdsel);
 				so->so_rcv.sb_flags |= SB_SEL;