-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Host: Fix L2CAP EINPROGRESS refs #76835
base: main
Are you sure you want to change the base?
Bluetooth: Host: Fix L2CAP EINPROGRESS refs #76835
Conversation
1867fcb
to
9f2dc36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also clean-up and submit the test that found the bug.
GitHub doesn't allow me to do inline review of commit messages, so I'll do it here:
The second function reference there should be |
2da64d7
to
9f9052e
Compare
9f9052e
to
6f00334
Compare
Added test and fixed the commented-on issues. |
6f00334
to
ae2630d
Compare
tests/bsim/bluetooth/host/l2cap/einprogress/tester/CMakeLists.txt
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/host/l2cap/einprogress/tester/src/tester.c
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/host/l2cap/einprogress/tester/src/tester.c
Outdated
Show resolved
Hide resolved
I'll delete the tester code, and rewrite the test. Basing it on a different test was a mistake. |
938ea3d
to
ae43589
Compare
ae43589
to
201b1c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blockers from me
@@ -262,13 +263,23 @@ void bt_send_one_host_num_completed_packets(uint16_t handle) | |||
BT_ASSERT_MSG(err == 0, "Unable to send Host NCP (err %d)", err); | |||
} | |||
|
|||
#if defined(CONFIG_BT_TESTING) | |||
__weak void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we might need a include/zephyr/bluetooth/testing.h
which would contain the various prototypes of testing-related functions and also properly document them. I noticed we have some existing cases that could use it, like here:
zephyr/tests/bsim/bluetooth/host/misc/disconnect/dut/src/main.c
Lines 32 to 33 in 1471c2f
/* Defined in hci_core.c */ | |
extern k_tid_t bt_testing_tx_tid_get(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to expose test functions in a public header file?
Honestly not sure what the best practices is for testing in Zephyr/C when it comes to things like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like that concern should be solvable with proper documentation. These APIs either way require explicitly enabling CONFIG_BT_TESTING
before they can be used. We could additionally output a build warning (if we don't already) that the configuration should not be used in production.
dae83b6
to
3ebe4e8
Compare
Fix discrepancy in reference management between calls to `bt_l2cap_chan_ops.recv` when the application returns `-EINPROGRESS`. There are two call sites, `l2cap_chan_le_recv_sdu` and `l2cap_chan_le_recv`, that were inconsistent. `l2cap_chan_le_recv_sdu` moves the reference, and this patch updates `l2cap_chan_le_recv` to do the same. This behavior is also now documented. This bug has existed since the introduction of this feature in 3151d26. Signed-off-by: Aleksander Wasaznik <[email protected]>
For ease of development, we should log the event as an error. Signed-off-by: Aleksander Wasaznik <[email protected]>
This is needed for a test to catch a double-free. Signed-off-by: Aleksander Wasaznik <[email protected]>
This is shorthand for random static addresses. It's similar to `bt_addr_le_from_str`, but is a macro that results in an object literal, making it more versatile and less verbose. This macro only gives access to the first 255 random static addresses, but this ought to be enough addresses for testing. Signed-off-by: Aleksander Wasaznik <[email protected]>
The test implementation is based on a copy of the HFC multilink test. The test verifies that the stack respects the reference counting of SDU buffers when the L2CAP -EINPROGRESS feature is used. Signed-off-by: Aleksander Wasaznik <[email protected]>
3ebe4e8
to
83cebe8
Compare
Fix discrepancy in reference management between calls to
bt_l2cap_chan_ops.recv
when the application returns-EINPROGRESS
.There are two call sites,
l2cap_chan_le_recv_sdu
andl2cap_chan_le_recv
, that were inconsistent.l2cap_chan_le_recv_sdu
moves the reference, and this patch updatesl2cap_chan_le_recv_sdu
to do the same.This behavior is also now documented.
This bug has existed since the introduction of this feature in 3151d26.
Signed-off-by: Aleksander Wasaznik [email protected]