Bluetooth: Fix having bogus entries in mgmt_read_index_list reply
authorJohan Hedberg <johan.hedberg@intel.com>
Fri, 19 Oct 2012 17:10:46 +0000 (20:10 +0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 9 Nov 2012 15:45:37 +0000 (16:45 +0100)
commit476e44cb19f1fbf2d5883dddcc0ce31b33b45915
treeee7320286f066bfec7739bb8f083367d47fe2d74
parent6fe7cc71bbf3a0bc28c9cec3c00bc11e81344412
Bluetooth: Fix having bogus entries in mgmt_read_index_list reply

The mgmt_read_index_list uses one loop to calculate the max needed size
of its response with the help of an upper-bound of the controller count.
The second loop is more strict as it checks for HCI_SETUP (which might
have gotten set after the first loop) and could result in some indexes
being skipped. Because of this the function needs to readjust the event
length and index count after filling in the response array.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Cc: stable@vger.kernel.org
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/mgmt.c