Re: [PATCH] Bluetooth: add timeout sanity check to hci_inquiry

From: Pavel Skripkin
Date: Thu Aug 19 2021 - 11:10:05 EST


On 8/19/21 6:05 PM, Marcel Holtmann wrote:
Hi Pavel,

}


/* Restrict maximum inquiry length to 60 seconds */
if (ir.length > 60) {
..
}

+ if (ir.length > HCI_INQUIRY_MAX_TIMEOUT) {
+ err = -EINVAL;
+ goto done;
+ }
+

I found this easier to read than adding anything define somewhere else. And since this is a legacy interface that is no longer used by bluetoothd, this should be fine. We will start to deprecate this eventually.

And I prefer 1 minute max time here. Just to be safe.


I thought, that user-space should be aware of maximum value, that's why I decided to add this define :) I didn't know, that this interface is legacy.

Will fix in v2, thank you!


With regards,
Pavel Skripkin