acassis commented on code in PR #18989:
URL: https://github.com/apache/nuttx/pull/18989#discussion_r3318140429
##########
net/bluetooth/bluetooth_poll.c:
##########
@@ -70,6 +70,17 @@ void bluetooth_poll(FAR struct net_driver_s *dev,
FAR struct radio_driver_s *radio;
DEBUGASSERT(dev != NULL && conn != NULL);
+
+ /* This function operates on Bluetooth radio devices only. It casts the
+ * generic net_driver_s to radio_driver_s below, so do not allow generic
+ * IP, PPP, TUN, loopback, CAN, or other non-Bluetooth devices through.
+ */
+
+ if (dev->d_lltype != NET_LL_BLUETOOTH)
+ {
+ return;
Review Comment:
@Stephen-F please include a debug error or warning to make debugging easier
for someone trying to fix issues
##########
net/devif/devif_poll.c:
##########
@@ -336,6 +336,21 @@ devif_poll_bluetooth_connections(FAR struct net_driver_s
*dev,
FAR struct bluetooth_conn_s *bluetooth_conn = NULL;
int bstop = 0;
+ DEBUGASSERT(dev != NULL);
+
+ /* Bluetooth sockets must only be polled on Bluetooth radio devices.
+ * bluetooth_poll() treats the generic net_driver_s as a radio_driver_s,
+ * which is only valid for NET_LL_BLUETOOTH devices. Without this guard,
+ * any active PF_BLUETOOTH socket causes every netdev poll, including PPP
+ * or TUN devices, to enter the Bluetooth poll path and corrupt that
+ * device's poll state.
+ */
+
+ if (dev->d_lltype != NET_LL_BLUETOOTH)
+ {
+ return 0;
Review Comment:
Ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]