You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/01/06 14:47:28 UTC
[incubator-nuttx] branch master updated: net/devif/devif_callback.c: devif_callback_free() call is not needed anymore in devif_callback_alloc()
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 8042de1 net/devif/devif_callback.c: devif_callback_free() call is not needed anymore in devif_callback_alloc()
8042de1 is described below
commit 8042de114551a3ea64f84ddb7b8f8fe4a24cd01c
Author: Alexander Lunev <al...@mail.ru>
AuthorDate: Thu Jan 6 16:33:11 2022 +0300
net/devif/devif_callback.c: devif_callback_free() call is not needed anymore in devif_callback_alloc()
---
net/devif/devif_callback.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c
index 1059533..8ee7ec1 100644
--- a/net/devif/devif_callback.c
+++ b/net/devif/devif_callback.c
@@ -274,11 +274,16 @@ FAR struct devif_callback_s *
* device in the UP state.
*/
+ /* Note: dev->d_flags may be asynchronously changed by netdev_ifdown()
+ * (in net/netdev/netdev_ioctl.c). Nevertheless, net_lock() / net_unlock()
+ * are not required in netdev_ifdown() to prevent dev->d_flags from
+ * asynchronous change here. There is not an issue because net_lock() and
+ * net_unlock() present inside of devif_dev_event(). That should be enough
+ * to de-allocate connection callbacks reliably on NETDEV_DOWN event.
+ */
+
if (dev && !netdev_verify(dev) && (dev->d_flags & IFF_UP) != 0)
{
- /* No.. release the callback structure and fail */
-
- devif_callback_free(NULL, NULL, list_head, list_tail);
net_unlock();
return NULL;
}