mirror of
https://github.com/apache/nuttx.git
synced 2025-05-09 06:42:10 +08:00
netlink:add tls cleanup protection to protect waitsem in netlink_get_response
Signed-off-by: wangchen <wangchen41@xiaomi.com>
This commit is contained in:
parent
807c3a16e3
commit
90e2395d6c
@ -385,7 +385,7 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void netlink_notifier_teardown(FAR struct netlink_conn_s *conn);
|
void netlink_notifier_teardown(FAR void *conn);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netlink_notifier_signal
|
* Name: netlink_notifier_signal
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/net/netconfig.h>
|
#include <nuttx/net/netconfig.h>
|
||||||
#include <nuttx/net/net.h>
|
#include <nuttx/net/net.h>
|
||||||
#include <nuttx/net/netlink.h>
|
#include <nuttx/net/netlink.h>
|
||||||
|
#include <nuttx/tls.h>
|
||||||
|
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include "netlink/netlink.h"
|
#include "netlink/netlink.h"
|
||||||
@ -533,7 +534,9 @@ int netlink_get_response(FAR struct netlink_conn_s *conn,
|
|||||||
{
|
{
|
||||||
/* Wait for a response to be queued */
|
/* Wait for a response to be queued */
|
||||||
|
|
||||||
|
tls_cleanup_push(tls_get_info(), netlink_notifier_teardown, conn);
|
||||||
ret = net_sem_wait(&waitsem);
|
ret = net_sem_wait(&waitsem);
|
||||||
|
tls_cleanup_pop(tls_get_info(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean-up the semaphore */
|
/* Clean-up the semaphore */
|
||||||
|
@ -97,8 +97,9 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void netlink_notifier_teardown(FAR struct netlink_conn_s *conn)
|
void netlink_notifier_teardown(FAR void *arg)
|
||||||
{
|
{
|
||||||
|
FAR struct netlink_conn_s *conn = arg;
|
||||||
DEBUGASSERT(conn != NULL);
|
DEBUGASSERT(conn != NULL);
|
||||||
|
|
||||||
/* This is just a simple wrapper around work_notifier_teardown(). */
|
/* This is just a simple wrapper around work_notifier_teardown(). */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user