summaryrefslogtreecommitdiffstats
path: root/stack/gatt/gatt_sr.c
diff options
context:
space:
mode:
authorAndre Eisenbach <andre@broadcom.com>2013-06-14 13:22:25 -0700
committerMatthew Xie <mattx@google.com>2013-08-13 18:24:00 -0700
commit4b63869f02e5860244fcc7f2f62e818ee702a74b (patch)
treecb7b91326c46ebc83208b569906890481fc3aab1 /stack/gatt/gatt_sr.c
parent181d075dac97efec96390db3b27db50861af5e7a (diff)
downloadandroid_system_bt-4b63869f02e5860244fcc7f2f62e818ee702a74b.tar.gz
android_system_bt-4b63869f02e5860244fcc7f2f62e818ee702a74b.tar.bz2
android_system_bt-4b63869f02e5860244fcc7f2f62e818ee702a74b.zip
LE: Limit minimum MTU size
Check requested MTU sizes to ensure a minimum MTU size. Otherwise remote devices may request an MTU that's too small, preventing any further communication with the remote device. Change-Id: I3ba97cf6e6c464825778a8c8902f99f6662c3762
Diffstat (limited to 'stack/gatt/gatt_sr.c')
-rw-r--r--stack/gatt/gatt_sr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/stack/gatt/gatt_sr.c b/stack/gatt/gatt_sr.c
index 71ba6a52c..b7ad6f927 100644
--- a/stack/gatt/gatt_sr.c
+++ b/stack/gatt/gatt_sr.c
@@ -911,10 +911,12 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
else
{
/* mtu must be greater than default MTU which is 23/48 */
- if (mtu <= GATT_MAX_MTU_SIZE)
- p_tcb->payload_size = mtu;
- else
+ if (mtu < GATT_DEF_BLE_MTU_SIZE)
+ p_tcb->payload_size = GATT_DEF_BLE_MTU_SIZE;
+ else if (mtu > GATT_MAX_MTU_SIZE)
p_tcb->payload_size = GATT_MAX_MTU_SIZE;
+ else
+ p_tcb->payload_size = mtu;
if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_MTU, (tGATT_SR_MSG *) &p_tcb->payload_size)) != NULL)
{