zephyr/subsys
Mike J. Chen a392c33c60 bluetooth: fix bug when destroying tx queue buffers on disconnect
Channel tx_queue purging on disconnect was inconsistently handled
by the different channels: iso, l2cap, l2cap_br.

iso channels handled purging in the tx_data_pull hook.

l2cap and l2cap_br did the purging in channel delete functions
and did not expect tx_data_pull to be called for a disconnected
channel. Their data_pull functions could return a ptr to a
net_buf that was still on the tx_queue, which is problematic
when the conn tx_processor unrefs the returned buffer resulting
in multiple calls to the buf destroy function.

To make things consistent and correct, remove the code that tries
to purge tx_queues in the tx_processor and only do purging in
the channels themselves when they are deleted/disconnected.

Also refactor and clarify referencing of the net_buf returned
by tx_data_pull. It was confusing who had a reference and
when, which could vary depending on the length of the original
buffer. There are three cases: the buffer length is less
than the tx.mps, greater the mps but less than the mtu so
requiring segementation but not fragmentation, or greater than
both mps and mtu so requiring both segmentation and fragmentation.
The conn layer would increase the refcnt if the length was
greater than the mtu, but not have any awareness of whether
the net_buf was still on the tx_queue or not.

Now it is the tx_data_pull callbacks responsibitity to increment
the reference count if it is returning a pointer to a net_buf
that it is still keeping on the tx_queue for segmentation purposes.
The conn layer will now always transfer that reference into a
fragment view and not conditional it on the length relative to
the mtu, and always decrement the reference to the parent when
the fragment is destroyed.

So there is no risk of decrementing a reference to a net buf
that might still be on a tx_queue, which simplifies error
handling in particular.

Also add error handling paths for when asserts are not enabled.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-07-03 11:59:02 -05:00
..
bindesc bindesc: fix typo in errno (ENONET->ENOENT) 2025-06-20 13:21:39 -04:00
bluetooth bluetooth: fix bug when destroying tx queue buffers on disconnect 2025-07-03 11:59:02 -05:00
canbus kconfig: fix typo in (soc, subsys) 2025-07-01 10:58:54 -10:00
console
dap dap: add DAP backend USB 2025-03-11 18:54:24 +01:00
debug kconfig: fix typo in (soc, subsys) 2025-07-01 10:58:54 -10:00
demand_paging demand_paging: use ram backend by default 2025-01-09 15:50:37 +01:00
dfu dfu: Add support for new MCUboot swap using offset mode 2025-02-10 19:05:25 +01:00
disk
dsp
emul
fb cfb: added API for drawing a circle 2025-06-26 22:09:48 -05:00
fs fs/ext2: Missing error check in ext2_inode_remove_blocks 2025-06-17 16:06:21 +02:00
input input: Fix function signature of input_thread 2025-06-18 07:41:25 +02:00
ipc kconfig: fix typo in (soc, subsys) 2025-07-01 10:58:54 -10:00
jwt modules: mbedtls: make key exchange Kconfigs depend on, not select 2025-05-13 22:22:43 -04:00
llext llext: adopt SHELL_HELP macro 2025-06-21 18:34:08 +02:00
logging kconfig: fix typo in (soc, subsys) 2025-07-01 10:58:54 -10:00
lorawan lorawan: add link check support. 2025-04-17 17:23:12 +02:00
mem_mgmt
mgmt mgmt: ec_host_cmd: backend: shi_npcx: fix log message 2025-07-02 17:58:20 -05:00
modbus modbus: fix Apache-2.0 SPDX License identifier case 2025-06-11 10:23:46 -07:00
modem ubx: Refactor codebase in order to improve usability 2025-05-30 19:40:19 +02:00
net tests: net: dns-sd: Fix undefined behavior reported by UBSAN 2025-07-02 03:55:06 -10:00
pm pm: device_runtime: fix unbalanced domain get/put 2025-06-24 09:14:20 +02:00
pmci pmci: mctp: Fix No SOURCES CMake warning 2025-04-23 17:55:19 +02:00
portability subsys/portability/cmsis_rtos_v2: Fix code compliance issues 2025-05-21 12:35:28 +02:00
profiling arch: Unify declaration of text region 2025-04-23 02:15:25 +02:00
random random: Correct Mutex define 2025-03-04 21:55:45 +01:00
retention
rtio rtio: Introduce OP_DELAY as a valid SQE operation 2025-04-30 09:48:16 +02:00
sd sd: fix incorrect error logging 2025-06-05 15:02:15 -05:00
secure_storage secure_storage: its: transform: improve expandability 2025-05-27 15:46:37 +02:00
sensing sensing: Fix static assert in get_sensor_by_dev() 2025-01-18 12:40:03 +01:00
settings settings: zms: fix out-of-bounds null terminator write 2025-06-26 11:12:49 +02:00
shell net: mgmt: Convert the mgmt API to use 64-bit masks 2025-06-18 10:54:44 +02:00
sip_svc
stats
storage storage: flash_map: Add support for sub-partitions 2025-06-11 10:13:56 -07:00
task_wdt task_wdt: Add suspend and resume API functions 2025-04-02 13:05:14 +02:00
testsuite ztest: native_sim: fail instead of crashing on wrong arguments 2025-07-01 10:16:54 -05:00
timing
tracing tracing: Allow disabling idle traces 2025-06-27 08:59:32 -10:00
usb usb: device_next: uac2: support higher bInterval values 2025-06-27 09:02:29 -10:00
zbus zbus: Improve consistency with runtime observers 2025-05-16 09:37:20 +02:00
CMakeLists.txt pmci: Move MCTP into the PMCI subsys 2025-04-21 12:43:33 +02:00
Kconfig pmci: Move MCTP into the PMCI subsys 2025-04-21 12:43:33 +02:00