Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11b4b0e6 authored by Griffin Kroah-Hartman's avatar Griffin Kroah-Hartman Committed by Greg Kroah-Hartman
Browse files

Bluetooth: MGMT: Add error handling to pair_device()



commit 538fd3921afac97158d4177139a0ad39f056dbb2 upstream.

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 <stable@kernel.org>
Fixes: 5157b8a5 ("Bluetooth: Fix initializing conn_params in scan phase")
Signed-off-by: default avatarGriffin Kroah-Hartman <griffin@kroah.com>
Reported-by: default avatarYiwei Zhang <zhan4630@purdue.edu>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e97be13a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2913,6 +2913,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;