diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c index db8d4e4fe3..3bd1f13a0a 100644 --- a/net/devif/devif_callback.c +++ b/net/devif/devif_callback.c @@ -124,13 +124,19 @@ FAR struct devif_callback_s * if (dev) { - /* Verify that the device is valid */ + /* Verify that the device pointer is valid, i.e., that it still + * points to a registered network device and also that the network + * device in in the UP state. + * + * And if it does, should that device also not be in the UP state? + */ - if (!netdev_verify(dev)) + if (!netdev_verify(dev) && (dev->d_flags & IFF_UP) != 0) { /* No.. release the callback structure and fail */ devif_callback_free(NULL, NULL, list); + net_unlock(save); return NULL; } diff --git a/net/netdev/netdev_verify.c b/net/netdev/netdev_verify.c index f4d39d2f91..6f2540f688 100644 --- a/net/netdev/netdev_verify.c +++ b/net/netdev/netdev_verify.c @@ -74,9 +74,9 @@ bool netdev_verify(FAR struct net_driver_s *dev) if (chkdev == dev) { - /* Yes.. return true if the interface is in the UP state */ + /* Yes.. return true */ - valid = ((dev->d_flags & IFF_UP) != 0); + valid = true; break; } } diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 5b87052cac..d8ea4a66b7 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -956,7 +956,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, } #endif /* CONFIG_NET_ARP_SEND */ - #ifdef CONFIG_NET_ICMPv6_NEIGHBOR #ifdef CONFIG_NET_ARP_SEND else