This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b76168223522660785e3e806319c7f119f7ee9d3
Author: mazhuang <[email protected]>
AuthorDate: Thu Jun 4 16:11:20 2026 +0800

    net/rpmsg: report a refused nonblocking connect in poll
    
    When the peer refuses a nonblocking connect with NS_DESTROY before the
    application calls poll(), the POLLHUP | POLLERR posted by
    rpmsg_socket_ns_unbind() finds no poll waiter and is lost.  The poll
    setup then checked conn->unbind only together with !_SS_INITD, which is
    false for a socket that has been set up, so no event was reported and
    poll() slept forever.
    
    Report POLLHUP | POLLERR whenever the connection is unbound, whether the
    NS_DESTROY arrives before or after poll() is set up.
    
    Signed-off-by: mazhuang <[email protected]>
---
 net/rpmsg/rpmsg_sockif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index 0869a6bf218..b639de96e04 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -1222,10 +1222,10 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
         }
       else /* !_SS_ISCONNECTED(conn->sconn.s_flags) */
         {
-          if ((!conn->ept.rdev || conn->unbind) &&
-              !_SS_INITD(conn->sconn.s_flags))
+          if (conn->unbind ||
+              (!conn->ept.rdev && !_SS_INITD(conn->sconn.s_flags)))
             {
-              eventset |= POLLHUP;
+              eventset |= POLLHUP | POLLERR;
             }
         }
 

Reply via email to