Skip to content

Commit 538fd39

Browse files
griffinkhVudentz
authored andcommitted
Bluetooth: MGMT: Add error handling to pair_device()
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. Cc: Stable <[email protected]> Fixes: 5157b8a ("Bluetooth: Fix initializing conn_params in scan phase") Signed-off-by: Griffin Kroah-Hartman <[email protected]> Reported-by: Yiwei Zhang <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 28cd47f commit 538fd39

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/bluetooth/mgmt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
34563456
* will be kept and this function does nothing.
34573457
*/
34583458
p = hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
3459+
if (!p) {
3460+
err = -EIO;
3461+
goto unlock;
3462+
}
34593463

34603464
if (p->auto_connect == HCI_AUTO_CONN_EXPLICIT)
34613465
p->auto_connect = HCI_AUTO_CONN_DISABLED;

0 commit comments

Comments
 (0)