mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
Bluetooth: Fix potential use-after-free when clear keys
[ Upstream commit3673952cf0
] Similar to commitc5d2b6fa26
("Bluetooth: Fix use-after-free in hci_remove_ltk/hci_remove_irk"). We can not access k after kfree_rcu() call. Fixes:d7d41682ef
("Bluetooth: Fix Suspicious RCU usage warnings") Signed-off-by: Min Li <lm0963hack@gmail.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6668886ebe
commit
e87da6a0ac
1 changed files with 8 additions and 8 deletions
|
@ -2343,9 +2343,9 @@ void hci_uuids_clear(struct hci_dev *hdev)
|
|||
|
||||
void hci_link_keys_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct link_key *key;
|
||||
struct link_key *key, *tmp;
|
||||
|
||||
list_for_each_entry(key, &hdev->link_keys, list) {
|
||||
list_for_each_entry_safe(key, tmp, &hdev->link_keys, list) {
|
||||
list_del_rcu(&key->list);
|
||||
kfree_rcu(key, rcu);
|
||||
}
|
||||
|
@ -2353,9 +2353,9 @@ void hci_link_keys_clear(struct hci_dev *hdev)
|
|||
|
||||
void hci_smp_ltks_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct smp_ltk *k;
|
||||
struct smp_ltk *k, *tmp;
|
||||
|
||||
list_for_each_entry(k, &hdev->long_term_keys, list) {
|
||||
list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) {
|
||||
list_del_rcu(&k->list);
|
||||
kfree_rcu(k, rcu);
|
||||
}
|
||||
|
@ -2363,9 +2363,9 @@ void hci_smp_ltks_clear(struct hci_dev *hdev)
|
|||
|
||||
void hci_smp_irks_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct smp_irk *k;
|
||||
struct smp_irk *k, *tmp;
|
||||
|
||||
list_for_each_entry(k, &hdev->identity_resolving_keys, list) {
|
||||
list_for_each_entry_safe(k, tmp, &hdev->identity_resolving_keys, list) {
|
||||
list_del_rcu(&k->list);
|
||||
kfree_rcu(k, rcu);
|
||||
}
|
||||
|
@ -2373,9 +2373,9 @@ void hci_smp_irks_clear(struct hci_dev *hdev)
|
|||
|
||||
void hci_blocked_keys_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct blocked_key *b;
|
||||
struct blocked_key *b, *tmp;
|
||||
|
||||
list_for_each_entry(b, &hdev->blocked_keys, list) {
|
||||
list_for_each_entry_safe(b, tmp, &hdev->blocked_keys, list) {
|
||||
list_del_rcu(&b->list);
|
||||
kfree_rcu(b, rcu);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue