From 8042de114551a3ea64f84ddb7b8f8fe4a24cd01c Mon Sep 17 00:00:00 2001 From: Alexander Lunev Date: Thu, 6 Jan 2022 16:33:11 +0300 Subject: [PATCH] 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 1059533376..8ee7ec114d 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; }