* [PATCH] Bluetooth: MGMT: Add error handling to pair_device()
@ 2024-08-15 11:51 Griffin Kroah-Hartman
2024-08-15 16:00 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Griffin Kroah-Hartman @ 2024-08-15 11:51 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz
Cc: linux-bluetooth, linux-kernel, Griffin Kroah-Hartman, Yiwei Zhang,
Stable
hci_conn_params_add() never checks for a NULL value and could lead to a NULL
pointer dereference causing a crash.
Fixed by adding error handling in the function.
Reported-by: Yiwei Zhang <zhan4630@purdue.edu>
Cc: Stable <stable@kernel.org>
Fixes: 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")
Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
---
net/bluetooth/mgmt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 40d4887c7f79..25979f4283a6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3456,6 +3456,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
* will be kept and this function does nothing.
*/
p = hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
+ if (!p) {
+ err = -EIO;
+ goto unlock;
+ }
if (p->auto_connect == HCI_AUTO_CONN_EXPLICIT)
p->auto_connect = HCI_AUTO_CONN_DISABLED;
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Bluetooth: MGMT: Add error handling to pair_device()
2024-08-15 11:51 [PATCH] Bluetooth: MGMT: Add error handling to pair_device() Griffin Kroah-Hartman
@ 2024-08-15 16:00 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2024-08-15 16:00 UTC (permalink / raw)
To: Griffin Kroah-Hartman
Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
zhan4630, stable
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 15 Aug 2024 13:51:00 +0200 you wrote:
> hci_conn_params_add() never checks for a NULL value and could lead to a NULL
> pointer dereference causing a crash.
>
> Fixed by adding error handling in the function.
>
> Reported-by: Yiwei Zhang <zhan4630@purdue.edu>
> Cc: Stable <stable@kernel.org>
> Fixes: 5157b8a503fa ("Bluetooth: Fix initializing conn_params in scan phase")
> Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
>
> [...]
Here is the summary with links:
- Bluetooth: MGMT: Add error handling to pair_device()
https://git.kernel.org/bluetooth/bluetooth-next/c/f2ed8d6d8aea
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-15 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 11:51 [PATCH] Bluetooth: MGMT: Add error handling to pair_device() Griffin Kroah-Hartman
2024-08-15 16:00 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox