hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/net/bluetooth/hci_core.c
....@@ -1623,6 +1623,7 @@
16231623 hdev->flush(hdev);
16241624
16251625 if (hdev->sent_cmd) {
1626
+ cancel_delayed_work_sync(&hdev->cmd_timer);
16261627 kfree_skb(hdev->sent_cmd);
16271628 hdev->sent_cmd = NULL;
16281629 }
....@@ -2342,9 +2343,9 @@
23422343
23432344 void hci_link_keys_clear(struct hci_dev *hdev)
23442345 {
2345
- struct link_key *key;
2346
+ struct link_key *key, *tmp;
23462347
2347
- list_for_each_entry(key, &hdev->link_keys, list) {
2348
+ list_for_each_entry_safe(key, tmp, &hdev->link_keys, list) {
23482349 list_del_rcu(&key->list);
23492350 kfree_rcu(key, rcu);
23502351 }
....@@ -2352,9 +2353,9 @@
23522353
23532354 void hci_smp_ltks_clear(struct hci_dev *hdev)
23542355 {
2355
- struct smp_ltk *k;
2356
+ struct smp_ltk *k, *tmp;
23562357
2357
- list_for_each_entry(k, &hdev->long_term_keys, list) {
2358
+ list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) {
23582359 list_del_rcu(&k->list);
23592360 kfree_rcu(k, rcu);
23602361 }
....@@ -2362,9 +2363,9 @@
23622363
23632364 void hci_smp_irks_clear(struct hci_dev *hdev)
23642365 {
2365
- struct smp_irk *k;
2366
+ struct smp_irk *k, *tmp;
23662367
2367
- list_for_each_entry(k, &hdev->identity_resolving_keys, list) {
2368
+ list_for_each_entry_safe(k, tmp, &hdev->identity_resolving_keys, list) {
23682369 list_del_rcu(&k->list);
23692370 kfree_rcu(k, rcu);
23702371 }
....@@ -2372,9 +2373,9 @@
23722373
23732374 void hci_blocked_keys_clear(struct hci_dev *hdev)
23742375 {
2375
- struct blocked_key *b;
2376
+ struct blocked_key *b, *tmp;
23762377
2377
- list_for_each_entry(b, &hdev->blocked_keys, list) {
2378
+ list_for_each_entry_safe(b, tmp, &hdev->blocked_keys, list) {
23782379 list_del_rcu(&b->list);
23792380 kfree_rcu(b, rcu);
23802381 }
....@@ -2684,10 +2685,10 @@
26842685
26852686 int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type)
26862687 {
2687
- struct smp_ltk *k;
2688
+ struct smp_ltk *k, *tmp;
26882689 int removed = 0;
26892690
2690
- list_for_each_entry_rcu(k, &hdev->long_term_keys, list) {
2691
+ list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) {
26912692 if (bacmp(bdaddr, &k->bdaddr) || k->bdaddr_type != bdaddr_type)
26922693 continue;
26932694
....@@ -2703,9 +2704,9 @@
27032704
27042705 void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type)
27052706 {
2706
- struct smp_irk *k;
2707
+ struct smp_irk *k, *tmp;
27072708
2708
- list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) {
2709
+ list_for_each_entry_safe(k, tmp, &hdev->identity_resolving_keys, list) {
27092710 if (bacmp(bdaddr, &k->bdaddr) || k->addr_type != addr_type)
27102711 continue;
27112712
....@@ -4907,7 +4908,7 @@
49074908 *req_complete_skb = bt_cb(skb)->hci.req_complete_skb;
49084909 else
49094910 *req_complete = bt_cb(skb)->hci.req_complete;
4910
- kfree_skb(skb);
4911
+ dev_kfree_skb_irq(skb);
49114912 }
49124913 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags);
49134914 }