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

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

commit f208c4bbd43d483ceafe41a13c0f63e2d476532e
Author: Michael Jung <[email protected]>
AuthorDate: Fri May 13 12:24:38 2022 +0200

    Fix ENOENT errors when polling on Netlink socket
    
    When a Netlink response is issued, which a task is currently polling for
    on the corresponding AF_NETLINK socket, then the poll call will return
    with a ENOENT error.  This is due to the fact that the Netlink response
    notifier is automatically torn down after the notification.
    
    Fixed by making netlink_notifier_teardown a best-effort function that
    does not return a result code.
    
    Signed-off-by: Michael Jung <[email protected]>
---
 net/netlink/netlink.h          |  6 +-----
 net/netlink/netlink_notifier.c | 11 ++---------
 net/netlink/netlink_sockif.c   |  2 +-
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h
index ccce4ab8d3..1d12abf70f 100644
--- a/net/netlink/netlink.h
+++ b/net/netlink/netlink.h
@@ -178,13 +178,9 @@ int netlink_notifier_setup(worker_t worker, FAR struct 
netlink_conn_s *conn,
  * Input Parameters:
  *   conn - Teardown the notification for this Netlink connection.
  *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned on
- *   any failure.
- *
  ****************************************************************************/
 
-int netlink_notifier_teardown(FAR struct netlink_conn_s *conn);
+void netlink_notifier_teardown(FAR struct netlink_conn_s *conn);
 
 /****************************************************************************
  * Name: netlink_notifier_signal
diff --git a/net/netlink/netlink_notifier.c b/net/netlink/netlink_notifier.c
index b101e4fa7f..782a9a6f65 100644
--- a/net/netlink/netlink_notifier.c
+++ b/net/netlink/netlink_notifier.c
@@ -93,26 +93,19 @@ int netlink_notifier_setup(worker_t worker, FAR struct 
netlink_conn_s *conn,
  * Input Parameters:
  *   conn - Teardown the notification for this Netlink connection.
  *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned on
- *   any failure.
- *
  ****************************************************************************/
 
-int netlink_notifier_teardown(FAR struct netlink_conn_s *conn)
+void netlink_notifier_teardown(FAR struct netlink_conn_s *conn)
 {
   DEBUGASSERT(conn != NULL);
-  int ret = OK;
 
   /* This is just a simple wrapper around work_notifier_teardown(). */
 
   if (conn->key > 0)
     {
-      ret = work_notifier_teardown(conn->key);
+      work_notifier_teardown(conn->key);
       conn->key = 0;
     }
-
-  return ret;
 }
 
 /****************************************************************************
diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c
index e1351bf4bf..d0a6c4f2eb 100644
--- a/net/netlink/netlink_sockif.c
+++ b/net/netlink/netlink_sockif.c
@@ -638,7 +638,7 @@ static int netlink_poll(FAR struct socket *psock, FAR 
struct pollfd *fds,
     {
       /* Cancel any response notifications */
 
-      ret = netlink_notifier_teardown(conn);
+      netlink_notifier_teardown(conn);
       conn->pollsem   = NULL;
       conn->pollevent = NULL;
     }

Reply via email to