diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 08a9314f3ca7f9d19bef0c98105545f839509d7e..37d9180bfe1c559902279da1ae4ba08422e2d50a 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -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);