mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
Bluetooth: hci_conn: return ERR_PTR instead of NULL when there is no link
hci_connect_sco currently returns NULL when there is no link (i.e. when
hci_conn_link() returns NULL).
sco_connect() expects an ERR_PTR in case of any error (see line 266 in
sco.c). Thus, hcon set as NULL passes through to sco_conn_add(), which
tries to get hcon->hdev, resulting in dereferencing a NULL pointer as
reported by syzkaller.
The same issue exists for iso_connect_cis() calling hci_connect_cis().
Thus, make hci_connect_sco() and hci_connect_cis() return ERR_PTR
instead of NULL.
Reported-and-tested-by: syzbot+37acd5d80d00d609d233@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=37acd5d80d00d609d233
Fixes: 06149746e7
("Bluetooth: hci_conn: Add support for linking multiple hcon")
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
de6dfcefd1
commit
b4066eb04b
@ -1684,7 +1684,7 @@ struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
|
||||
if (!link) {
|
||||
hci_conn_drop(acl);
|
||||
hci_conn_drop(sco);
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOLINK);
|
||||
}
|
||||
|
||||
sco->setting = setting;
|
||||
@ -2254,7 +2254,7 @@ struct hci_conn *hci_connect_cis(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
if (!link) {
|
||||
hci_conn_drop(le);
|
||||
hci_conn_drop(cis);
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOLINK);
|
||||
}
|
||||
|
||||
/* If LE is already connected and CIS handle is already set proceed to
|
||||
|
Loading…
Reference in New Issue
Block a user