提交 2b8df323 编写于 作者: M Marcel Holtmann 提交者: Johan Hedberg

Bluetooth: Add paranoid check for existing LE and BR/EDR SMP channels

When the SMP channels have been already registered, then print out a
clear WARN_ON message that something went wrong. Also unregister the
existing channels in this case before trying to register new ones.
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 327a7191
......@@ -3072,6 +3072,12 @@ int smp_register(struct hci_dev *hdev)
if (!lmp_le_capable(hdev))
return 0;
if (WARN_ON(hdev->smp_data)) {
chan = hdev->smp_data;
hdev->smp_data = NULL;
smp_del_chan(chan);
}
chan = smp_add_cid(hdev, L2CAP_CID_SMP);
if (IS_ERR(chan))
return PTR_ERR(chan);
......@@ -3091,6 +3097,12 @@ int smp_register(struct hci_dev *hdev)
return 0;
}
if (WARN_ON(hdev->smp_bredr_data)) {
chan = hdev->smp_bredr_data;
hdev->smp_bredr_data = NULL;
smp_del_chan(chan);
}
chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
if (IS_ERR(chan)) {
int err = PTR_ERR(chan);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册