Bluetooth: controller: verify DLE req_rsp has valid values

During testing, lr->max_rx_octets and lr->max_tx_octets were
at times set to 0.  If we use these 0 values, we end up with
very erratic behavior.  Best, to check for a sane value and
if invalid, default to the value in _radio.conn_curr->max_*x_octets.

Change-Id: I57c0e3790d988f0de17993cebe5c5c2ab0fc07a6
Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
Michael Scott 2017-05-09 23:25:23 -07:00 committed by Johan Hedberg
commit 5699af2af0

View file

@ -1615,14 +1615,18 @@ static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
/* use the minimal of our default_tx_octets and
* peer max_rx_octets
*/
eff_tx_octets = min(lr->max_rx_octets,
_radio.conn_curr->default_tx_octets);
if (lr->max_rx_octets >= RADIO_LL_LENGTH_OCTETS_RX_MIN) {
eff_tx_octets = min(lr->max_rx_octets,
_radio.conn_curr->default_tx_octets);
}
/* use the minimal of our max supported and
* peer max_tx_octets
*/
eff_rx_octets = min(lr->max_tx_octets,
RADIO_LL_LENGTH_OCTETS_RX_MAX);
if (lr->max_tx_octets >= RADIO_LL_LENGTH_OCTETS_RX_MIN) {
eff_rx_octets = min(lr->max_tx_octets,
RADIO_LL_LENGTH_OCTETS_RX_MAX);
}
/* check if change in rx octets */
if (eff_rx_octets != _radio.conn_curr->max_rx_octets) {