mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
Bluetooth: MGMT: Add error handling to pair_device()
commit538fd3921a
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:5157b8a503
("Bluetooth: Fix initializing conn_params in scan phase") Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com> Reported-by: Yiwei Zhang <zhan4630@purdue.edu> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0fa4b4aadb
commit
064dd929c7
|
@ -3449,6 +3449,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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user