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 <michael.jung@secore.ly>
This commit is contained in:
Michael Jung 2022-05-13 12:24:38 +02:00 committed by Petro Karashchenko
parent 0178792a01
commit f208c4bbd4
3 changed files with 4 additions and 15 deletions

View File

@ -178,13 +178,9 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
* Input Parameters: * Input Parameters:
* conn - Teardown the notification for this Netlink connection. * 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 * Name: netlink_notifier_signal

View File

@ -93,26 +93,19 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
* Input Parameters: * Input Parameters:
* conn - Teardown the notification for this Netlink connection. * 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); DEBUGASSERT(conn != NULL);
int ret = OK;
/* This is just a simple wrapper around work_notifier_teardown(). */ /* This is just a simple wrapper around work_notifier_teardown(). */
if (conn->key > 0) if (conn->key > 0)
{ {
ret = work_notifier_teardown(conn->key); work_notifier_teardown(conn->key);
conn->key = 0; conn->key = 0;
} }
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -638,7 +638,7 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
{ {
/* Cancel any response notifications */ /* Cancel any response notifications */
ret = netlink_notifier_teardown(conn); netlink_notifier_teardown(conn);
conn->pollsem = NULL; conn->pollsem = NULL;
conn->pollevent = NULL; conn->pollevent = NULL;
} }