-
Notifications
You must be signed in to change notification settings - Fork 8k
Bluetooth: Controller: Fix missing conn update ind PDU validation #72608
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: Controller: Fix missing conn update ind PDU validation #72608
Conversation
@thoh-ot @erbr-ot @wopu-ot @kruithofa is this behavior to let procedure/supervision timeout an acceptable outcome? |
4992255
to
f7f65af
Compare
I tend to think we should be more pro-active in case of invalid params and disconnect with BT_HCI_ERR_INVALID_LL_PARAM. This could make recovery from a central mistake faster. |
Take at look at how invalid LL_PHY_UPDATE_IND are handled in zephyr/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c Lines 714 to 747 in 99adbad
|
f7f65af
to
8e762f6
Compare
Fix missing validation of Connection Update Ind PDU. Ignore invalid connection update parameters and force a silent local connection termination. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
8e762f6
to
e91b3e3
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.
Changes look good, with some minor suggestions for improved readability
return (interval_max >= CONN_INTERVAL_MIN(conn)) && | ||
(interval_max <= CONN_UPDATE_CONN_INTV_4SEC) && | ||
(latency <= CONN_UPDATE_LATENCY_MAX) && | ||
(timeout >= CONN_UPDATE_TIMEOUT_100MS) && | ||
(timeout <= CONN_UPDATE_TIMEOUT_32SEC) && | ||
((timeout * 4U) > /* *4U re. conn events is equivalent to *2U re. ms */ | ||
((latency + 1U) * interval_max)); |
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.
Suggest to make this more readable by using the IN_RANGE
macro
} | ||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ | ||
|
||
static bool cu_check_conn_ind_parameters(struct ll_conn *conn, struct proc_ctx *ctx) |
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.
Suggest to rename check
to valid
or something.
If a check
function returns true, is it really obvious that it's valid?
IMO check
works better with int
than bool
Fix missing validation of Connection Update Ind PDU. Ignore invalid connection update parameters and let the connection either procedure timeout or supervision timeout if the central switched to using invalid connection parameters.