Bluetooth: Store UUIDs in the same order that they were added
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 26 Jan 2013 22:31:27 +0000 (00:31 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 1 Feb 2013 17:50:16 +0000 (15:50 -0200)
We should be encoding UUIDs to the EIR data in the same order that they
were added to the kernel, i.e. each UUID should be added to the end of
the UUIDs list. This patch fixes the issue by using list_add_tail
instead of list_add for storing the UUIDs.

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

index e7f944f52ff27e0a1a2e069dd8185804f4084ef5..4fd45a3271e02b0195fed6295fe753619ceed71a 100644 (file)
@@ -1330,7 +1330,7 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
        memcpy(uuid->uuid, cp->uuid, 16);
        uuid->svc_hint = cp->svc_hint;
 
-       list_add(&uuid->list, &hdev->uuids);
+       list_add_tail(&uuid->list, &hdev->uuids);
 
        err = update_class(hdev);
        if (err < 0)