Stephen-F opened a new pull request, #18989:
URL: https://github.com/apache/nuttx/pull/18989

   ## Summary
   
   `devif_poll_bluetooth_connections()` is called for every registered network 
device during a poll cycle. `bluetooth_poll()` unconditionally casts its 
`net_driver_s *` argument to `radio_driver_s *`, which is only valid for 
`NET_LL_BLUETOOTH` devices. When a non-Bluetooth device (e.g. a PPP modem) 
triggers a poll while a `PF_BLUETOOTH` socket is active, the code enters the 
Bluetooth poll path with an incompatible device pointer and corrupts that 
device's TX poll state.
   
   Add `d_lltype != NET_LL_BLUETOOTH` guards at the top of both 
`devif_poll_bluetooth_connections()` and `bluetooth_poll()` to return early on 
non-Bluetooth devices.
   
   ## Impact
   
   Users of `PF_BLUETOOTH` sockets on systems with at least one non-Bluetooth 
netdev (e.g. PPP, loopback, TUN) will silently see poll state corruption on 
those devices when Bluetooth polling runs. This fix short-circuits the 
Bluetooth poll path for non-BT devices without any API, ABI, or Kconfig changes.
   
   ## Testing
   
   Tested on a custom ARM Cortex-M33 board (STM32H5-based) with an STM32WB BLE 
co-processor connected over HCI UART. The board registers a PPP modem netdev 
alongside the BT netdev. With an open `PF_BLUETOOTH` socket, 
`devif_poll_bluetooth_connections()` was entered for the PPP device, corrupting 
its poll state and preventing UDP data from being sent. With this fix, the 
Bluetooth poll path is skipped for non-`NET_LL_BLUETOOTH` devices and UDP 
operation is unaffected.
   
   Host: Linux x86_64, GCC ARM toolchain.


-- 
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]

Reply via email to