Bluetooth: Fix potential use-after-free when clear keys
authorMin Li <lm0963hack@gmail.com>
Mon, 7 Aug 2023 11:07:41 +0000 (19:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:32 +0000 (09:42 +0200)
commit94617b736c25091b60e514e2e7aeafcbbee6b700
treeefa328f13a0f4f78c5e325e36f0488dff0c6d454
parent9246d9310cd6d8e94219ac9f6c5ace8bb52bc76c
Bluetooth: Fix potential use-after-free when clear keys

[ Upstream commit 3673952cf0c6cf81b06c66a0b788abeeb02ff3ae ]

Similar to commit c5d2b6fa26b5 ("Bluetooth: Fix use-after-free in
hci_remove_ltk/hci_remove_irk"). We can not access k after kfree_rcu()
call.

Fixes: d7d41682efc2 ("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>
net/bluetooth/hci_core.c