mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Bluetooth: Fix potential NULL dereference
The bnep_get_device function may be triggered by an ioctl just after a connection has gone down. In such a case the respective L2CAP chan->conn pointer will get set to NULL (by l2cap_chan_del). This patch adds a missing NULL check for this case in the bnep_get_device() function. Reported-by: Patrik Flykt <[email protected]> Signed-off-by: Johan Hedberg <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
This commit is contained in:
parent
8f0c304c69
commit
88d9077c27
1 changed files with 3 additions and 4 deletions
|
|
@ -511,13 +511,12 @@ static int bnep_session(void *arg)
|
|||
|
||||
static struct device *bnep_get_device(struct bnep_session *session)
|
||||
{
|
||||
struct hci_conn *conn;
|
||||
struct l2cap_conn *conn = l2cap_pi(session->sock->sk)->chan->conn;
|
||||
|
||||
conn = l2cap_pi(session->sock->sk)->chan->conn->hcon;
|
||||
if (!conn)
|
||||
if (!conn || !conn->hcon)
|
||||
return NULL;
|
||||
|
||||
return &conn->dev;
|
||||
return &conn->hcon->dev;
|
||||
}
|
||||
|
||||
static struct device_type bnep_type = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue