@@ -2153,6 +2153,9 @@ static int set_mesh_sync(struct hci_dev *hdev, void *data)
2153
2153
else
2154
2154
hci_dev_clear_flag (hdev , HCI_MESH );
2155
2155
2156
+ hdev -> le_scan_interval = __le16_to_cpu (cp -> period );
2157
+ hdev -> le_scan_window = __le16_to_cpu (cp -> window );
2158
+
2156
2159
len -= sizeof (* cp );
2157
2160
2158
2161
/* If filters don't fit, forward all adv pkts */
@@ -2167,6 +2170,7 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2167
2170
{
2168
2171
struct mgmt_cp_set_mesh * cp = data ;
2169
2172
struct mgmt_pending_cmd * cmd ;
2173
+ __u16 period , window ;
2170
2174
int err = 0 ;
2171
2175
2172
2176
bt_dev_dbg (hdev , "sock %p" , sk );
@@ -2180,6 +2184,23 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2180
2184
return mgmt_cmd_status (sk , hdev -> id , MGMT_OP_SET_MESH_RECEIVER ,
2181
2185
MGMT_STATUS_INVALID_PARAMS );
2182
2186
2187
+ /* Keep allowed ranges in sync with set_scan_params() */
2188
+ period = __le16_to_cpu (cp -> period );
2189
+
2190
+ if (period < 0x0004 || period > 0x4000 )
2191
+ return mgmt_cmd_status (sk , hdev -> id , MGMT_OP_SET_MESH_RECEIVER ,
2192
+ MGMT_STATUS_INVALID_PARAMS );
2193
+
2194
+ window = __le16_to_cpu (cp -> window );
2195
+
2196
+ if (window < 0x0004 || window > 0x4000 )
2197
+ return mgmt_cmd_status (sk , hdev -> id , MGMT_OP_SET_MESH_RECEIVER ,
2198
+ MGMT_STATUS_INVALID_PARAMS );
2199
+
2200
+ if (window > period )
2201
+ return mgmt_cmd_status (sk , hdev -> id , MGMT_OP_SET_MESH_RECEIVER ,
2202
+ MGMT_STATUS_INVALID_PARAMS );
2203
+
2183
2204
hci_dev_lock (hdev );
2184
2205
2185
2206
cmd = mgmt_pending_add (sk , MGMT_OP_SET_MESH_RECEIVER , hdev , data , len );
@@ -6432,6 +6453,7 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
6432
6453
return mgmt_cmd_status (sk , hdev -> id , MGMT_OP_SET_SCAN_PARAMS ,
6433
6454
MGMT_STATUS_NOT_SUPPORTED );
6434
6455
6456
+ /* Keep allowed ranges in sync with set_mesh() */
6435
6457
interval = __le16_to_cpu (cp -> interval );
6436
6458
6437
6459
if (interval < 0x0004 || interval > 0x4000 )
0 commit comments